August 1999
Intermediate to advanced
1488 pages
72h 53m
English
document.bgColor
The bgColor property specifies the background color of HTML document. The color is expressed as a string in hexadecimal digits or as one of the JavaScript standard color names. The hexadecimal form is made up of six digits that follow the pattern "RRGGBB." The color of the background can also be set with bgcolor attribute of the <body> tag.
Listing 7.57 changes the document's background color based on which button is chosen.
<html> <form> <input type="button" value="Yellow" name="Yellow" onClick="changeBG('yellow')"> <input type="button" value="Green" name="Green" onClick="changeBG('green')"> ... |
Read now
Unlock full access