Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript - overflow error with IE 5.5

Status
Not open for further replies.

tterrapin

Programmer
Jan 18, 2001
12
CA
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=&quot;Precache()&quot; text=&quot;#999999&quot; bgcolor=&quot;#FFFFFF&quot; link=&quot;#FFCCFF&quot; vlink=&quot;#FFCCFF&quot; alink=&quot;#FF0080&quot; background=&quot;starbkgrd.gif&quot;>
 
I'm not sure, but don't you have to specify which element of the array you're refering to?

for(i = 0;i < picnameArr.length;i++) {
picobjectArr = new Image(picwidthArr,picheightArr)
picobjectArr.src = picnameArr
}

HTH,
- Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top