View Full Version : Need a little help with this script

06-11-2010, 08:02 PM
I'm using this javascript on my site, it works perfect. The script changes the background image on the site, just need some mods and I'm no expert.

<script language="JavaScript">

// Copyright 2001 by www.CodeBelly.com
// Please do *not* remove this notice.

var backImage = new Array(); // don't change this

// Enter the image filenames you wish to use.
// Follow the pattern to use more images. The
// number in the brackets [] is the number you
// will use in the function call to pick each
// image.

// Note how backImage[3] = "" -- which would
// set the page to *no* background image.

backImage[1] = "/images/bg1.jpg";
backImage[2] = "/images/bg2.jpg"
backImage[3] = "/images/bg3.jpg"
backImage[4] = "/images/bg4.jpg"
backImage[5] = "/images/bg5.jpg"

// backImage[4] = ""; this will set to no image

// Do not edit below this line.

function changeBGImage(whichImage){
if (document.body){
document.body.background = backImage[whichImage];

How Can I set the parameters for the images with the following

background-attachment: fixed;
background-repeat: no-repeat;
background-position: top

and make the first image the default background when the site comes up



06-11-2010, 08:46 PM
Start with #2 from the Forum Guidelines (http://www.codingforums.com/postguide.htm).

Then, set your desired options in your CSS.