Random Background Color, JavaScript Code


This is a JavaScript for html to change color of website background with the touch of a button. It changes the color randomly with the preset colors of you choice.

There are two parts of code you need to put into your HTML. As you seen in the text area bellow, first one insert between <head> </head> tags, and second code insert into your HTML body tags where you want to show this button for clicks.

The color names inside the code are preset, you can change it as you wish. You can refer to the W3C HTML Color Names for more details about complete list of the color names which is supported by all major browsers.

Script Demo:




Demo


JavaScript Code:


Insert this code into <head> tags


Insert this code into <body> tags


Instruction:

Change the following text:

  • YOUR TEXT HERE = Text on the button.

Webmaster » Web Programming » JavaScript » Background Effects » Random Background Color


 Related Links:

Home | Sitemap | Bookmark This Page
Sponsored Links