Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Thanked 0 Times in 0 Posts

    Need a little help with this script

    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



  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Thanked 330 Times in 326 Posts
    Start with #2 from the Forum Guidelines.

    Then, set your desired options in your CSS.
    Are you a Help Vampire?


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts