I want to use javascript to populate a section of an HTML page with thumbnails of images that link to full-size images. Currently, all that happens when this code is run is a listing of p open and close. I want this to make thumbnails for img (#), where # is 1-41.
JavaScript:
document.getElementById('img').innerHTML = "<p>"
for( var img = 1; img >= 41; img++)
{
document.getElementById('img').innerHTML += ("<a href='img/pic (" + img + ").JPG'><img src='img/thumbs/pic (" + img + ").png' width=156 height=84 alt='img " + img + "'></a>")
}
document.getElementById('img').innerHTML += "</p>"
HTML:
<div class="main">
<div id="img"><div>
</div>
source
share