Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    image popup with description

    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()'>");
    newWin.document.write("</FORM></P>");
    newWin.document.write("</BODY>");

    }
    -->
    </script>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Code:
    <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()">');
    newWin.document.write('</form></p>');
    newWin.document.write('</body>');
    }
    </script>
    Also add it to your function call "openWin(..."This is a picture of my friend Fred")
    Last edited by Antoniohawk; 02-02-2004 at 10:05 PM.

  • #3
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks! i had tried that and it was giving me an error but it worked this time, don't know what the difference was.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •