Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing

Example 14.1:
Referring to Windows

First, click on this button to open a child window. In that window, click on the button to open yet another window (the grandchild). Then return to this window:

Now, click on these buttons to change the status-bar messages in all three windows. Switch to the child and grandchild windows to see the messages in the status bars.

Now click on these buttons to close the other windows (you must click the first button first; if you click the second one first, the first one won't work):


This is the script we used in the HEAD: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- function WinOpen() { Win1=open("child.htm","Window1","resize,status,height=400,width=575"); } //--> </SCRIPT> Then these buttons: <FORM> <input type="button" name="WindowButton" value="Open a Child Window" onclick="WinOpen()"><P> <I>Now, click on these buttons to change the status-bar messages in all three windows. Switch to the child and grandchild windows to see the messages in the status bars.</I><P> <INPUT TYPE="BUTTON" VALUE="This window's status bar: self.defaultStatus" onclick="self.defaultStatus='This is the current window\'s status bar'"><P> <INPUT TYPE="BUTTON" VALUE="The child window's status bar: Win1.defaultStatus" onclick="Win1.defaultStatus='The child window\'s status bar'"><P> <INPUT TYPE="BUTTON" VALUE="The grandchild window's status bar: Win1.Win2.defaultStatus" onclick="Win1.Win2.defaultStatus='The grandchild window\'s status bar'"><P> <I>Now click on these buttons to close the other windows (you must click the first button first; if you click the second one first, the first one won't work):</I><BR> <INPUT TYPE="BUTTON" VALUE="Close the grandchild window: Win1.Win2.close()" onclick="Win1.Win2.close()"> <INPUT TYPE="BUTTON" VALUE="Close the child window: Win1.close()" onclick="Win1.close()"> </FORM>
Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing