Guardian-Mage Posted August 2, 2007 Share Posted August 2, 2007 I have a slideshow that is different than others. Part of it is it needs to be automated. var slideLength = 27; var lock = false; var run; var idvar = '001'; function changeImage(dir) { if (document.images) { curImg = curImg + dir; if (curImg > slideLength) { curImg = 1; } if (curImg < 1) { curImg = slideLength; } if (document.getElementById(curImg)) { var nextImage = document.getElementById(curImg).innerHTML; } else { curImg++; } document.getElementById('slideshow').innerHTML = nextImage; document.getElementById('slide').value = curImg; } } This will take the content of a table and load it. But say I have objects with the ID 3,4,5,6,8 but no 7. My script needs to skip it. Part of what I have works. It will skip the number but than it says the nextImage is not defined. I need it so when it says else { curImg++; } It will than retry the if loop to see if the new object exists Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.