...

View Full Version : array and loop



zodehala
06-10-2008, 10:28 PM
how can i make following shorter (as a loop)


fadeimages[0]=["mkportal/images/0.jpg", "http://www.google.com/images/0.jpg", "_new"]
fadeimages[1]=["mkportal/images/1.jpg", "http://www.google.com/images/1.jpg", "_new"]
fadeimages[2]=["mkportal/images/2.jpg", "http://www.google.com/images/2.jpg", "_new"]
fadeimages[3]=["mkportal/images/3.jpg", "http://www.google.com/images/3.jpg", "_new"]
fadeimages[4]=["mkportal/images/4.jpg", "http://www.google.com/images/4.jpg", "_new"]
fadeimages[5]=["mkportal/images/5.jpg", "http://www.google.com/images/5.jpg", "_new"]
fadeimages[6]=["mkportal/images/6.jpg", "http://www.google.com/images/6.jpg", "_new"]
fadeimages[7]=["mkportal/images/7.jpg", "http://www.google.com/images/7.jpg", "_new"]
fadeimages[8]=["mkportal/images/8.jpg", "http://www.google.com/images/8.jpg", "_new"]
fadeimages[9]=["mkportal/images/9.jpg", "http://www.google.com/images/9.jpg", "_new"]

mrhoo
06-11-2008, 12:52 AM
var fadeimages= [],i= 0;
while(i<10){
fadeimages[i]= [
'mkportal/images/'+i+'.jpg',
'http://www.google.com/images/'+i+'.jpg',
'_new'
]
i+=1;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum