SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict gthorley's Avatar
    Join Date
    Oct 2000
    Location
    Canada
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the same basic menu on each page and created the rollover code with Dreamweaver. It includes a preload. When looking at my site log it appears that every time a page is loaded it automatically calls the images again. If they are still in the browser cache why does it do this?

    Would I be better to have the preload only on the main index page and then just let the browser call if it isn't in cache anymore on subsequent pages?

    Added Later

    I just noticed something weird which I can't understand
    Looking at the source for my main page I see the following
    <body text="#000000" bgcolor="#FFFFFF" link="#FFFFF0" vlink="#FFFFF0" alink="#FF0000" background="images/index_bg.jpg" &nbsp; onLoad="">
    The onload is followed by ="" yet on my original on my hard drive it is onLoad="all the names of the rollover image files">

    It seems to still work and I assume Dreamweaver changed this code at some point on a revision I made to my site. I did upgrade to Dreamweaver 4.0. Does the "" simply load all image files in the menu? Would I be better to put the names back in
    Last edited by gthorley; Apr 25, 2001 at 20:25.

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dreamweaver's preload images function SUCKS!. I don't think I have EVER seen it work properly.

    I would recommend using a simpler, cleaner version of the code.

    Try this method:

    <!-- rollover scripting -->
    <script language="javascript">
    <!--

    if (document.images) {

    contact_us_on = new Image();
    contact_us_on.src = "images/contact_us_on.gif";
    contact_us_off = new Image();
    contact_us_off.src = "images/contact_us_off.gif";

    }

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

    // -->
    </script>


    and call it using this method


    <a href="contact_us.shtml" onmouseover="changeImages('contact_us','contact_us_on')" onmouseout="changeImages('contact_us','contact_us_off')"><img name="contact_us" src="images/contact_us_off.gif" alt="contact us" width="133" height="18" border="0"></a>
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


Bookmarks

Posting Permissions

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