[thelist] preloader question
miinx
miinx at miinx.com.au
Sat Mar 3 18:16:10 CST 2001
I have just replaced some code that explicitly preloaded some images for
a double rollover with a preloader function (see code below). However,
I now find that whenever I mouse over said images a call is made to the
server, which didn't happen before.
I thought that preloading, however it was done, should stop this. Is
there anything wrong with the function code below that would cause this?
Or am I wrong in my assumption about preloading?
--------------- explicit preloading ---------------
// each set of images was preloaded like this:
grape_on = new Image();
grape_on.src="images/navmenu/nav6/menuitems2/grape_on.gif";
grape_off = new Image();
grape_off.src="images/navmenu/nav6/menuitems2/grape_off.gif";
grape_ad1 = new Image();
grape_ad1.src="images/navmenu/nav6/faces/tripper.gif";
--------------- preloader function ---------------
function preload() {
var spb = "images/navmenu/nav6/" // string path base
var temp = spb + "menuitems2/";
var sPath = new Array(temp, temp, (spb + "faces/"));
var state = new Array("_on", "_off", "ad1");
var aImgs = new Array("grape", "bio", "club", "busi", "sounds", "play",
"pics", "cont", "links", "gear", "crew");
var aFaces = new Array("tripper", "grin", "lashlips", "grin", "thumbs",
"grin", "princesspink2", "wideyegrn", "indiaflame", "lashblue", "ohoh");
var aOn = new Array(); // _on images
var aOff = new Array(); // _off images
var aAd1 = new Array(); // 2nd rollover images
var iNew, iSrc;
var i, k;
for (i=0; i<aImgs.length; i++) { // outer loop thru images
for (k=0; k<3; k++) { // inner loop thru states
stt = state[k];
pth = sPath[k];
ext = (stt=="ad1") ? "" : stt;
iNew = aImgs[i] + stt + " = new Image();"; // on img
eval(iNew);
iSrc = aImgs[i] + stt + ".src = '" + pth + aImgs[i] + ext + ".gif'"
eval(iSrc);
}
}
}
---------------------------------------------
The site is http://www.monkey.com.au/frames2.html - it's the left-hand
navigation frame.
Thanks in advance,
Karen
--
http://www.miinx.com.au/
http://www.monkey.com.au/
More information about the thelist
mailing list