JavaScript Thumbnail Gallery

When you click on a thumbnail, a new window opens with a larger version of the image.

Example

Click on an image to see the full-size version

Thumbnail 0 Thumbnail 1 Thumbnail 2

 

 

Script Source

<Under the head section>

<script type="text/javascript">

<!-- Hide script from old browsers

function newWindow(imgNumber) {

imgName = "images/Img" + imgNumber + ".jpg"

imgWindow = window.open(imgName,"imgWin","width=320,height=240,scrollbars=no")

}

// End hiding script from old browsers -->
</script>

<Under the body section>

<img src="images/Img0.jpg" width="160" height="120" hspace="10" border="3" alt="Thumbnail 0" onclick="newWindow(0)" />
<img src="images/Img1.jpg" width="160" height="120" hspace="10" border="3" alt="Thumbnail 1" onclick="newWindow(1)" />
<img src="images/Img2.jpg" width="160" height="120" hspace="10" border="3" alt="Thumbnail 2" onclick="newWindow(2)" />

Please Note: The onclick attribute of the IMG tag is not supported in Netscape Navigator 6.0

 

Please let me know if this script was helpful to you.