[thelist] JS image preload problem in NS4

miinx miinx at miinx.com.au
Tue May 29 23:24:22 CDT 2001


Hi Listers,

I am going silly trying to figger out why my image preload function won't work in NS4.x

This is the function:
---------
var aImgs = new Array("mintro", "mdept", "munder", "minternat", "mpostgrad")

function preload() {
   if (document.images) {
      var sPath = "../../navbar/images/"
      var state = new Array("0", "1");

      for (var i=0; i<aImgs.length; i++) {
         for (var k=0; k<2; k++) {
            eval(aImgs[i] + "_" + state[k] + " = new Image();")
            eval(aImgs[i] + "_" + state[k] + ".src = '" + sPath + aImgs[i] + "_" + state[k] + ".gif';")
         }
      }
}
---------

If I query the length of document.images at the end, it returns 0.  When I try to rollover an image, 
Netscape reports that 'document.whateverimage' has no properties.

Can anyone see my problem?

Many thanks,
Karen






More information about the thelist mailing list