Results 1 to 2 of 2

Thread: Parent Child relation

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    266
    Dear all,
    I have a parent browser window which invokes another browser window(the child). Is it possible for me to transfer some data from the child window back to a text field in the parent window? A code snippet would be great.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    try this:

    parent.html
    Code:
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript"><!--
    function newWindow(file,window) {
         msgWindow=open('',window,'resizable=no,width=200,height=200');
         msgWindow.location.href = file;
         if (msgWindow.opener == null) msgWindow.opener = self;
    }
    //--></SCRIPT>
    </HEAD>
    <body>
    <FORM name=frm1>
    <INPUT TYPE="button" VALUE="Open New Window" onClick="newWindow('child.html','window2')">
    <BR>
    
    
    <INPUT NAME="txt1"> 
    </FORM>     
    
    </body>
    </HTML>
    child.html
    Code:
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript"><!--
    function doit()
    {
    
    opener.document.frm1.txt1.value='Hello World';
    
    
    }
    //--></SCRIPT>
    
    </head>
    <body>
    <INPUT type=button onClick="doit();">
    
    
    </body>
    </HTML>
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width