...

View Full Version : whats problem in this code ?



PHPycho
07-18-2007, 05:27 AM
Hello forums!!
I am using this code for preloading images

var images = new Array();
var i = 0;
images[0] = "img/image1.gif";
:
:
images[4] = "img/image5.gif";
//alert(images.length);
// start preloading..
for(i = 0; i < images.length; i++){
var imageObj[i] = new Image();
imageObj[i].src = images[i];
}
and following error occurs (in firebug)

missing ; before statement
[Break on this error] var imageObj[i] = new Image(); \n
Any Idea where i went wrong ..
thanks in advance to all of you

glenngv
07-18-2007, 06:01 AM
Remove the var keyword. You are not declaring a variable here. You are setting an array element.

var imageObj[i] = new Image();



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum