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

Example 10.2:
Setting the bgColor Property


This page sets the 'bgColor' property of a the document object to "indigo" and then allows the user to change the color by clicking buttons.

These are the scripts we used. First, this in the HEAD: <SCRIPT LANGUAGE="JavaScript"> <!-- document.bgColor = "indigo" //--> </SCRIPT> Then this in the BODY: <FORM> <INPUT TYPE="button" VALUE="Red" onclick="document.bgColor = 'red'"> <INPUT TYPE="button" VALUE="Blue" onclick="document.bgColor = 'blue'"> <INPUT TYPE="button" VALUE="Green" onclick="document.bgColor = 'green'"> <INPUT TYPE="button" VALUE="White" onclick="document.bgColor = 'white'"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing