rollover's not showing up...?

Discussion in 'Web Design' started by Decibel, Jul 12, 2005.

to remove all ads.
  1. Decibel

    Decibel New Member

    Messages:
    1
    Hi from new member, i'm trying to make a website, i've taught myself everything, but get stuck sometimes and dont know what to do, luckily i found this site.

    Could someone please take a look at my coding and tell me where i'm going wrong, the rollover images just wont show up, they are in the same 'Images' folder alongside the html files.

    my site: http://www.sugaray.co.uk/Decibel/home.html

    many thanks
    Rosco
     
  2. Eclipse

    Eclipse New Member

    Messages:
    19
    I didn't view your source code, do you have two images for your rollovers?

    This is what I use:

    (between your head tags)

    <script type="text/javascript">

    function newImage(arg) {
    if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
    }
    }

    function changeImages() {
    if (document.images && (preloadFlag == true)) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
    document[changeImages.arguments].src = changeImages.arguments[i+1];
    }
    }
    }

    var preloadFlag = false;
    function preloadImages() {
    if (document.images) {
    home_roll_01_over = newImage("yourimage.gif");
    preloadFlag = true;
    }
    }

    </script>


    (in your body tag)

    onload="preloadImages();

    <a href="index.html"
    onmouseover="changeImages('image_off', 'image_on.gif'); return true;"
    onmouseout="changeImages('image_off', 'images_off.gif'); return true;"
    onmousedown="changeImages('image_off', 'images_on.gif'); return true;"
    onmouseup="changeImages('image_off', 'images_on.gif'); return true;">


    Then just repeat for each button/link.
    Hope that helps.
     

Share This Page