JavaScript, by clicking on the button to change the page background and font color, the page has n change the color of the button, click on different buttons, the page font and background will be changed to different colors. Very simple JavaScript applet.
I. BASIC OBJECTIVES
Open a webpage first prompt greeting message "Hello"
There are n buttons in the page that change color, which returns the default color of the page, the background is white, the font is black
By clicking on a different button, the font and background of the page will change to different colors.
Originally wanted to make a rainbow improvement, but the principle is exactly the same as not much write button.
Second, the basic idea
The key is to provide ID to the body tag and the font JS, so that it is controlled in JS. This example provides an application to the JS function.
Third, the production process
For a simple small page, see the Notes for details:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The OnUnload () function is almost only valid when IE closes this page, and the dialog is not at the forefront, and Google Chrome has no effect. Therefore, this function has little meaning.
"JavaScript" Easily changes the color of the page background and font