JS for loop to cycle through images for html

alvito

New member
Apr 22, 2011
100
0
0
Im using this code:



<div id="thumbScroller">
<div class="container">

<script type="text/javascript">
for(i = 13; i < 30; i++){
document.write('<div class="content">')
document.write('<div><a href="#"><img src="images/images/thumbs/' + i + '.jpg" alt="images/images/' + i +'.jpg" class="thumb" /></a></div>')
document.write('</div>')
}
</script>



</div>
</div>


it should work right? why doesnt it? the images dont pop up, but firebug shows that the html script is being populated with the images13-30
 


semicolons aren't a hard requirement in Javascript, you can omit them and most code will still run exactly the same.

OP, post a link to your page you're working on so I can just look at the code directly