I copied code on this site for preloading images. The code works fine in Netscape 4.75 but I get an overflow error with IE. The overflow error is occuring on the first for loop. Below is the code which I have in my program:
Any ideas??? I would appreciate them.
function Precache(){
var i = 0
//this one takes the pic names, if the paths are different, put them
//here also otherwise add them as a string later
var picnameArr =new
Array("pic1.gif","pic2.gif","pic3.gif","pic4.gif","pic5.gif","pic6.gif","pic7.gif","pic8.jpg","pic9.jpg"
//this one takes all the heights of the images, it should be of equal
//size to the previous Array
var picheightArr = new Array(38,38,38,38,38,38,38,364,217)
//this one takes all the widths of the images, it should be of equal
//size to the previous Array
var picwidthArr = new Array(126,166,166,161,164,164,118,288,157)
//this one takes images as objects
var picobjectArr = new Array()
//loop through and build the object array
for(i = 0;i < picnameArr.length;i++){
picobjectArr = new Image(picwidthArr,picheightArr)
picobjectArr.src = picnameArr
}
for(i = 0;i < document.images.length;i++){
document.images.src = picobjectArr
}
//}
//-->
</script>
</head>
<body onload="Precache()" text="#999999" bgcolor="#FFFFFF" link="#FFCCFF" vlink="#FFCCFF" alink="#FF0080" background="starbkgrd.gif">
Any ideas??? I would appreciate them.
function Precache(){
var i = 0
//this one takes the pic names, if the paths are different, put them
//here also otherwise add them as a string later
var picnameArr =new
Array("pic1.gif","pic2.gif","pic3.gif","pic4.gif","pic5.gif","pic6.gif","pic7.gif","pic8.jpg","pic9.jpg"
//this one takes all the heights of the images, it should be of equal
//size to the previous Array
var picheightArr = new Array(38,38,38,38,38,38,38,364,217)
//this one takes all the widths of the images, it should be of equal
//size to the previous Array
var picwidthArr = new Array(126,166,166,161,164,164,118,288,157)
//this one takes images as objects
var picobjectArr = new Array()
//loop through and build the object array
for(i = 0;i < picnameArr.length;i++){
picobjectArr = new Image(picwidthArr,picheightArr)
picobjectArr.src = picnameArr
}
for(i = 0;i < document.images.length;i++){
document.images.src = picobjectArr
}
//}
//-->
</script>
</head>
<body onload="Precache()" text="#999999" bgcolor="#FFFFFF" link="#FFCCFF" vlink="#FFCCFF" alink="#FF0080" background="starbkgrd.gif">