• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Managing Browser Windows > 6.7. Communicating Back to the Main Window

Communicating Back to the Main Window

NN 3, IE 3

Problem

You want a script in a subwindow to access variables or document content in the main window.

Solution

With one very early exception (Netscape 2), all scriptable browsers automatically assign an opener property to a window created via the window.open( ) method. Scripts in the subwindow can reach the main window or frame via this opener property. Here is an example of a subwindow script that copies a text box value from the subwindow to a hidden input field in the main window:

opener.document.forms["userData"].age.value = document.forms["entry"].userAge.value;

The opener property references the window or frame whose script executed the window.open( ) method.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint