what is the problem of this loop?
for(i=0; i<18; i++)
{
$("'#various'+i+1").fancybox({
Something
});
}
it is supposed to be various1,开发者_Go百科 various2, etc
thanks
$("#various"+(i+1)).fancybox({
The i
variable needs to be outside the quotes.
for(i=1; i<=18; i++) {
$("#various"+i).fancybox({ /*...*/ });
}
Problem is bad syntax in your string concatenation.
for(var i=1; i<19; i++) {
$('#various'+i).fancybox({
'Something':'val'
});
}
for(var i = 0; i < 18; i++){
$('#various' + (i + 1)).fancybox({
// something
});
}
精彩评论