Javascript arrays don't have to be in order, they just (generally, in practical use, such as in this script) cannot have any missing entries.
So, though I'm not sure exactly what you are objecting to, it makes no difference (other than the order in which the entries will be used, which will always start at 0 and go to the highest number) if you have:
Code:
var myvacation=new Array()
myvacation[0]=["../photo1.jpg", "", "photo1-large.jpg"]
myvacation[1]=["photo2.jpg", "Our car", ""]
myvacation[2]=["photo3.jpg", "Our dog", "photo3-large.jpg"]
myvacation[3]=["photo4.jpg", "Our hotel", "http://www.gohawaii.com/"]
myvacation[4]=["photo5.jpg", "Our Computer", "http://www.google.com", "_new"]
myvacation[5]=["photo6.jpg", "Our house", "photo6-large.jpg"]
myvacation[6]=["photo7.jpg", "Our Friends", "http://www.ask.com"]
or:
Code:
var myvacation=new Array()
myvacation[6]=["../photo1.jpg", "", "photo1-large.jpg"]
myvacation[5]=["photo2.jpg", "Our car", ""]
myvacation[4]=["photo3.jpg", "Our dog", "photo3-large.jpg"]
myvacation[3]=["photo4.jpg", "Our hotel", "http://www.gohawaii.com/"]
myvacation[2]=["photo5.jpg", "Our Computer", "http://www.google.com", "_new"]
myvacation[1]=["photo6.jpg", "Our house", "photo6-large.jpg"]
myvacation[0]=["photo7.jpg", "Our Friends", "http://www.ask.com"]
or even:
Code:
var myvacation=new Array()
myvacation[6]=["../photo1.jpg", "", "photo1-large.jpg"]
myvacation[1]=["photo2.jpg", "Our car", ""]
myvacation[3]=["photo3.jpg", "Our dog", "photo3-large.jpg"]
myvacation[5]=["photo4.jpg", "Our hotel", "http://www.gohawaii.com/"]
myvacation[0]=["photo5.jpg", "Our Computer", "http://www.google.com", "_new"]
myvacation[2]=["photo6.jpg", "Our house", "photo6-large.jpg"]
myvacation[4]=["photo7.jpg", "Our Friends", "http://www.ask.com"]
Just as long as the numbers all make up an uninterrupted sequence starting at 0.
Bookmarks