PDA

View Full Version : Oh dear, I can't even make an img preloader work...



Bob90
03-25-2007, 02:09 AM
Hi,

Oh the shame :confused:

I don't know why, any help would be appreciated.


// displayMenuItems
menuItemsAr = new Array();
//array_of_items[order] = "url,target,image,image_rollover,title"
menuItemsAr[0] = "http://www.robertgarford.com|_self|home.png|home50.png|Home"
menuItemsAr[1] = "http://www.robertgarford.com/images/index.php?loc=|_self|photos.png|photos50.png|Photos"
menuItemsAr[2] = "http://www.robertgarford.com/work|_self|work.png|work50.png|Work"
menuItemsAr[3] = "http://www.robertgarford.com/code|_self|code.png|code50.png|Code"
menuItemsAr[4] = "http://www.robertgarford.com/hobbies|_self|hobby.png|hobby50.png|Hobbies"
menuItemsAr[5] = "http://www.robertgarford.com/blog|_self|blog.png|blog50.png|Blog"
menuItemsAr[6] = "http://www.robertgarford.com/contact|_self|contact.png|contact50.png|Contact"
menuItemsAr[7] = "Javascript:killContextMenu(),void(0)||kill.png|kill50.png|Kill menu"

//Image preloader
imgPreloadArray = new Array();
for(var x=0; x<menuItemsAr.length; x++)
{
var tempAr = menuItemsAr[x].split("|");
if(tempAr[3] && tempAr[3]!="") //if rollover image {preload}
{
imgPreloadArray[imgPreloadArray.length] = new Image();
imgPreloadArray[imgPreloadArray.length-1].src = tempAr[3];
}
//preload standard image for rollback
imgPreloadArray[imgPreloadArray.length] = new Image();
imgPreloadArray[imgPreloadArray.length-1].src = tempAr[2];
}
//Image preloader

You can see the problem on my webpage. Just right click.

Bob90
03-25-2007, 02:10 AM
I just didn't make the images absolute. The images weren't stored in the same folder. Duh :p