SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sending value from a popup to parent

    I want send a value from a function in the popup to function of parent page that called the popup

    please help me

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you would do this on the popup page

    Code:
    function OnPopUpPage() {
      var ValueToPass = "hello";
      //call parent function
      parent.FunctionDefinedOnParentPage(ValueToPass);
    }

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This code can not work :
    index
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    
      <script language="javascript">
    function FunctionDefinedOnParentPage(xls){
    alert(xls);
    }
      </script>
    </head>
    <body>
    
    <input type="button" onclick="window.open('child.html')" value="LOAD POPUP">
    <br>
    
    </body>
    </html>

    and popup file (child.html)

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    
    </head>
    
    
    <body>
    
    <script language="javascript">
    function OnPopUpPage() {
      var ValueToPass = "hello";
      parent.FunctionDefinedOnParentPage(ValueToPass);
    }
    </script>
    <input type="button" onclick="OnPopUpPage()" value="SEND">
    
    <br>
    
    </body>
    </html>

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using window.opener instead of parent


Bookmarks

Posting Permissions

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