I have a forloop in javascript, which has 120 values, what i want is, i always want to skip the first values which the loop holds and always want to jump to next value which loop will generate, as i have several if conditions, value of i
won't be always 0,1,2,3,4,5 etc.. it could be anything like 23,28,30,32 etc. below is my source code:
Have a look at the last line of the loop.
for (i = 0; i < document.links.length; i++) {
L = document.links[i];
ext = (L.href.indexOf('?') == -1) ? L.href.slice(-4).toLowerCase() : L.href.substring(0, L.href.indexOf('?')).slice(-4).toLowerCase();
if (ext != '.jpg' && ext != '.png' && ext != '.gif' && ext != 'jpeg') continue;
if (a == 'sh' && L.className.toLowerCase().indexOf('shutter') == -1) continue;
if (a == 'lb' && L.rel.toLowerCase().indexOf('lightbox') == -1) continue;
if (L.className.toLowerCase().indexOf('shutterset') != -1)
setid = L.className.replace(/\s/g, '_');
else if (L.rel.toLowerCase().indexOf('lightbox[') != -1)
setid = L.rel.replace(/\s/g, '_');
else setid = 0, inset = -1;
if (setid) {
if (!shutterSets[setid]) shutterSets[setid] = [];
inset = shutterSets[setid].push(i);
}
imgdetails = L.innerHTML;
console.log(imgdetails);
img1 = jQuery.trim(imgdetails);
alttext = jQuery(img1).attr('alt');
shfile = L.href.slice(L.href.lastIndexOf('/') + 1);
T = (L.title && L.title != shfile) ? L.title : '';
//alert(inset);
shutterLinks[i] = {
link: L.href,
num: inset,
set: setid,
title: T,
imagealt: alttext
}
//on below line, where i is being called i always want to skip the first value and always pass from second value.
L.onclick = new Function('shutterReloaded.make("' + i + '");return false;');
}
Can anyone please help me with this.