View Full Version : image popup with description

02-02-2004, 09:50 PM
I have a basic thumbnail viewer that when an image is clicked it pops up in a new window full size. I want a description to appear along with the image, but because of the number of images i have i want to try and use a variable string with the description as part of the "onClick" for each image. How would i set this up? Any help would be appreciated. The popup script is:

<script language="JavaScript1.2">
function openWin(winHeight,winWidth,picSrc){
newWin = window.open('', '', 'height='+ winHeight + ',width='+ winWidth + 'toolbars=no, scrollbars=NO' );
newWin.document.write("<HEAD><TITLE>IMAGE VIEWER</TITLE></HEAD>");
newWin.document.write("<BODY BGCOLOR=BLACK BACKGROUND='pics/webbackgroundtile.jpg'>");
newWin.document.write("<P ALIGN=CENTER>");
newWin.document.write("<TABLE COL=2 WIDTH=80% ALIGN=CENTER BORDER=2><TR><TD><IMG SRC="+ picSrc +"></TD><TD>"+ description +"</TD></TR></TABLE>");
newWin.document.write("<BR><BR><BR><FORM><input type='button' value='Close' onclick='JavaScript:window.close()'>");


02-02-2004, 09:57 PM
<script language="JavaScript1.2">
function openWin(winHeight,winWidth,picSrc,description){
newWin = window.open('', '', 'height='+ winHeight + ',width='+ winWidth + 'toolbars=no, scrollbars=NO' );
newWin.document.write('<head><title>IMAGE VIEWER</title></head>');
newWin.document.write('<body bgcolor="#000000" background="pics/webbackgroundtile.jpg">');
newWin.document.write('<p align="center">');
newWin.document.write('<table col="2" width="80%" align="center" border="2"><tr><td><img src='+ picSrc +'></td><td>'+ description +'</td></tr></table>');
newWin.document.write('<br><br><br><form><input type="button" value="Close" onclick="JavaScript:window.close()">');

Also add it to your function call "openWin(..."This is a picture of my friend Fred")

02-03-2004, 01:15 AM
Thanks! i had tried that and it was giving me an error but it worked this time, don't know what the difference was.