DHTML script
 

SimplytheBest
Scripts

ASP scripts
PERL scripts
PHP scripts
JavaScripts & Ajax
Snippets
Online scripts

Ajax, DHTML
& JavaScripts

Animation
Background
Bookmarks
Buttons
Calculators
Cookies
Data handling
E-mail
Enhancements
Forms
Image rotation
Menus
Messages
Miscellaneous
Music
Password protection
Redirection
Scrollers
Tables
Time & date
Windows

Publishers
Add script
Account login
Publisher list



 

Home > Scripts > DHTML scripts & JavaScripts > Background > Background color fader

 

Background color fader script

AUTHOR: Geoff Baysinger
TYPE: Freeware
BROWSERS: IE 4+, IE 5+, IE 6+

This script makes the background fade into a set number of colors.


EXAMPLE

You should have seen the background color faded into when opening this page. Click Refresh on your browser to see it again.


1)
Insert this script in the <HEAD> section of the page.

then copy (CTRL-C) & paste (CTRL-V)

 

2) Insert the following script right after the <BODY> tag in the page.

then copy (CTRL-C) & paste (CTRL-V)

3) Define the colors and the number of steps for each transition in this section of the script. By deleting a bgChanger line you remove the transition, so it's easy to decide on the number of transitions.:

// black to black (pause)
bgChanger("000000","000000",350);
// black to red
bgChanger("000000","FF0000",350);
// red to black
bgChanger("FF0000","000000",350);
// black to blue
bgChanger("000000","0000FF",350);
// blue to black
bgChanger("0000FF","000000",350);
// black to white
bgChanger("000000","FFFFFF",350);

You must use Hex values, color names will not work. Do not put a # in front of the parameters, just use the Hex values. The larger the last parameter (25 in this example) the smoother the transition will look.


[BACK] [TOP]

 


Copyright © 1997-2009 SimplytheBest Inc. Terms of Use and Legal Disclaimer.
All copyrights are acknowledged. All rights reserved.