So, You Want A Background JavaScript, Huh?

By Joe Burns

Thanks to Josh Robbins for this script.

Please note: This is a background JavaScript and as such, it often doesn't play well with background images. You may not be able to have a background image on your page if you use this script.

     Okay, here we go. This one is super simple AND you can actually play around with it to change the flow of the colors. First off, the script. Just cut and paste what's below. Paste the whole deal without changing the configuration or the spacing between the items. That can corrupt it. Here you go:


The Script Is Here

     If you look closely, you'll see that there are two scripts, one right after the other. I don't quite understand why, but you need both of them just as I offer it. Grab the whole thing -- or both things, as it were.

     Paste the script right under your <HTML> command, before the title commands. In this position it will run before putting up any text. Then write the rest of your page as you would any other.

Changing Colors

     Look at the second of the two scripts where it states:

// black to black (pause)
bgChanger("000000","000000",25);

     Notice it has names of colors and then those strange six-number codes. Those are hex codes. You'll find a ton of them (140 to be exact) in my So, You Want A Basics Color Code, Huh? tutorial. Now, I don't know how much you can actually play with this script -- I would keep a clean copy handy -- but I changed the final codes so it ended on white rather than black and it worked. I don't believe you have to change the names of the colors. It worked without me doing it one time. So, try a few other combinations and please let me know what happened. I'll pass the word along.

     Man, these tutorials are getting too easy! I should start bringing Plato into them. He was big into the Net. I'll bet you didn't know that.

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •