Previous Example-|-Next Example-|-Return to Chapter Listing

Example 16.3:
Referring to Frames

Click on the buttons to change the colors:


These are the scripts we used. First, this in the HEAD: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- function resetColors() { window.document.bgColor="white" top.frames[1].document.bgColor="white" top.frames[2].document.bgColor="white" top.frames[3].document.bgColor="white" } //--> </SCRIPT> Then these buttons: <FORM> <INPUT TYPE="button" VALUE="Change first frame to Orange" onclick="parent.frames[0].document.bgColor='orange'"><P> <INPUT TYPE="button" VALUE="Change frame2 to Red" onclick="parent.frames[1].document.bgColor='red'"><P> <INPUT TYPE="button" VALUE="Change frame3 to Green" onclick="parent.frame3.document.bgColor='green'"><P> <INPUT TYPE="button" VALUE="Change frame4 to Blue" onclick="top.frames[3].document.bgColor='blue'"><P> <INPUT TYPE="button" VALUE="Reset Colors" onclick="resetColors()"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing