Change Layer Colors | JavaScriptSource

Change Layer Colors

Antonio Lupetti Mar 17, 2008


Use these two simple functions to change text and background colors within a specified layer without reloading the page. Can be used separately or together.

Example 1
Change the background color using a fixed color in the script

» Change Background color

Watch the background color change!

Example 2
Change text and background color with user-selected colors:

Text color:

Background color:

» Change text and background color
Watch the text and background colors change!


Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: changeLayerColors.js


Paste this code into the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document

Leave a Response