Forum Moderators: open
<a href="javascript:;"onClick="window.open('images/dog_large.jpg', 'animals', config='height=600,width=600,top=25')"> <img src="images/dog_small.jpg" alt=
"dog_small.jpg (149264 bytes)" width="194" height="146" ></a>
I wasn't sure if you were talking about having to write the anchor tag 400 times or the window.open 400 times. If you meant the latter, something like this should work assuming that all the thumbnails end in '_small.jpg' and all the large images end in '_large.jpg':
<script type="text/javascript">
<!--
//obj is the calling link
//win is the window name
//h is the window height
//w is the window width
function showLarge(obj,win,h,w){
//get src of thumbnail image
var smallSrc=obj.firstChild.src
//swap out _small with _large
var bigSrc=smallSrc.replace('_small','_large')
//open the window
window.open(bigSrc, win, config='height='+h+',width='+w+',top=25')
}
//-->
</script>
</head>
<body>
<a href="javascript:void(0)" onclick="showLarge(this,'animals',600,600)"><img src="images/dog_small.jpg" alt=
"dog_small.jpg (149264 bytes)" width="194" height="146" ></a>
If your large images will always fit in a 600x600 window, you could omit the h and w parameters.
Also, if you want only one popup window as opposed to one for 'animals' one for 'category2', etc. you can omit the win parameter and just use a constant for the window name.
Hope this helps,
ajkimoto