I'm trying to create an images on the page to represent thumbnails, however my current code only shows the last image on in the directory. How do I make the for loop create a new image on my page each time it iterates.
<img id="tpic" src="http://example.net/test%20page/001.jpg" width="20%" height="20%">
<script type="text/javascript">
var y = 1;
var picurl2 = "http://example.net/test%20page/00"+y+".jpg";
document.getElementById("tpic").src=picurl2;
document.getElementById("divThumb").innerHTML = document.getElementById("pic2").src;
for (y = 1; y < 18; y++)
{
if (y<10){
picurl2 = "http://example.net/test%20page/00"+y+".jpg";
}
else{
picurl2 = "http://example.net/test%20page%20/0"+y+".jpg";
}
document.getElementById("tpic").src=picurl2;
}
</script>