The JavaScript Programming Language

Background Color Example Program


Click below to go directly to a specific section:
Description| Source Code| Sample Run

Description

The background changes when a button is pressed.

Source Code

<html> <head> <title>Changing Background Color</title> </head> <body> <FORM METHOD="POST" NAME="background"> <INPUT TYPE="button" VALUE="Blue" ONCLICK="document.bgColor='#0000FF'"><BR> <INPUT TYPE="button" VALUE="Red" ONCLICK="document.bgColor='#FF0000'"><BR> <INPUT TYPE="button" VALUE="Green" ONCLICK="document.bgColor='#00FF00'"><BR> <INPUT TYPE="button" VALUE="White" ONCLICK="document.bgColor='#FFFFFF'"><BR> </FORM> </body> </html>

Sample Run






[Back] [Home]

Last Modified: 01:40 PM on 12/09/1997