Results 1 to 3 of 3

Thread: Return value to parent windows

  1. #1
    Join Date
    Jul 2006
    Location
    Kajang
    Posts
    9
    Rep Power
    0

    Return value to parent windows

    Hai...

    Aku nak tanya sapa-sapa yang tau macam mana nak buat popup windows & kemudian return value ke dalam parent windows.

    TQ...

  2. #2
    Join Date
    Aug 2006
    Location
    malacca
    Posts
    2
    Rep Power
    0
    ni bukan bende yg exactly ko nak. mungkin berguna utk ko. ni utk refresh parent. bole la ubah pape sket. aku buat bende ni utk open popup > klik button (update database) > popup close > refresh parent.


    Code:
    <script language="JavaScript">
    <!--
    function refreshParent() {
      window.opener.location.href = window.opener.location.href;
      if (window.opener.progressWindow)
        window.opener.progressWindow.close();
      window.close();
    }
    //-->
    </script>
    tambah sket kat body

    PHP Code:
    <?php
      
    if ($updateSQL) {
      echo 
    "<body onload='refreshParent()'>"; }
      
      
    ?>
    $updateSQL = updaate DB.

  3. #3
    Join Date
    Aug 2006
    Location
    Perak
    Posts
    8
    Rep Power
    0
    This is one way to do it :

    first write a javascript function in your parent page :

    Code:
    function set(id, value) {
         document.getElementById(id).value = value;
    }
    then, in your popup page, add the appropriate javascript (let's say after clicking a button the page will close and return the value)

    Code:
    function closePopup(target_id) {
         window.opener.set(target_id, '123');
         window.close();
    }
    add the onClick event on a button in the popup page :

    HTML Code:
    <input type="submit" name="Submit" value="OK" onclick="return closePopup('textBox1')">
    So, when u click the button, it will set the value of 'textBox1' in the mainpage to '123' and then close the popup page. You can modify the closePopup() function and return the correct value.

    Hope this help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need help and your time, for nothing in return!
    By Seanie in forum Website Programming
    Replies: 9
    Last Post: 07-07-2009, 09:38 AM
  2. Iframe loses it parent after it been refreshed itself with different url
    By iamfreelancer in forum Website Programming
    Replies: 0
    Last Post: 30-10-2008, 06:25 PM
  3. Replies: 0
    Last Post: 18-12-2005, 10:34 AM
  4. return value from oracle..
    By shakker in forum Website Programming
    Replies: 0
    Last Post: 23-08-2004, 09:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39