Yea, I actually didn't have ; there before, just put it there to see if it would "fix" the problem. I thought that I had to put var in front of all variables that appear within a for loop, so that they stay local? Anyways, thanks for the help.
Yea, I actually didn't have ; there before, just put it there to see if it would "fix" the problem. I thought that I had to put var in front of all variables that appear within a for loop, so that they stay local? Anyways, thanks for the help.
try replacing:
array_name=[]; preload=[];
with:
array_name= new Array(); preload=new Array();
What is the error produced?
The error thats produced is:
missing ; before statement
var preload = new Image();
imgarray.js (line 31)
Though honestly, I think I'm going to ignore this error. I just noticed that the firefox javascript inspector reports no errors with it, however "Firebug" (an extension I have installed) found error with it. If you see something I'm doing wrong, or something that's bad style which would cause Firebug to spit out errors, feel free to let me know, otherwise I'm gonna consider this problem "solved".
Hello All,
I have a javascript image preloading script I'm writing, and it basically creates an array called "array_name" which contains the image filenames, and then uses a for loop to assign "array_name"'s elements to another array called "preload". I know my syntax is good, but the firefox javascript inspector is complaining each time I attempt to run this. Can anyone take a look at the code, and tell me what I'm doing wrong?
Thank You
function imgLoad() {
array_name=[];
preload=[];
array_name[0]='images/bgcolor.gif';
array_name[1]='images/blackdot.gif';
array_name[2]='images/bold.gif';
array_name[3]='images/centre.gif';
array_name[4]='images/copy.gif';
array_name[5]='images/cut.gif';
array_name[6]='images/email.gif';
array_name[7]='images/hr.gif';
array_name[8]='images/hyperlink.gif';
array_name[9]='images/image.gif';
array_name[10]='images/indent.gif';
array_name[11]='images/insert_table.gif';
array_name[12]='images/italic.gif';
array_name[13]='images/justifyfull.gif';
array_name[14]='images/left_just.gif';
array_name[15]='images/list.gif';
array_name[16]='images/numbered_list.gif';
array_name[17]='images/outdent.gif';
array_name[18]='images/paste.gif';
array_name[19]='images/redo.gif';
array_name[20]='images/right_just.gif';
array_name[21]='images/smiley.gif';
array_name[22]='images/spellcheck.gif';
array_name[23]='images/textcolor.gif';
array_name[24]='images/underline.gif';
array_name[25]='images/undo.gif';
for (var i = 0; i < array_name.length; i++) {
var preload[i] = new Image();
preload[i].src = array_name[i];
}
}
Hello All!
I've recently started a few blogs and I'm looking for advice on content creation and submission. One of them is personal, and I pretty much have that covered, but the other one is something I plan on turning into an online goto resource for news, information, commentary, and product recommendations for our community. I guess I'm going through a bit of writers block on this project since I've never really done anything like this before, but I do have a good idea of what I'd like to see on the site, I'm just not sure where to start. Also, where do I get content? The subject matter we're covering is energy conservation.
Thanks in advance!
{-_-}
It was up for about a week, but they took the link down to overwhelming traffic :(
Hey Everybody!
I was googling for help regarding my Vista x64 printing problems, and I found this site. Took a look around, and it definately looks like my kind of community, so I decided to join. Looking forward to many intelligent discussions!
{-_-}