Javascript Popup Image Window

37

This script opens a window using the image dimensions as the control. When you do not want to jeopardize convention and need a Click to enlarge Button, use this code.

<script><!--
function imagePopUp(img) {
html = "<html><head><title>Enlarged Image</title>" + "</head><body style="margin: 0px 0; text-align:center; ">" + "<IMG src='" + img + "' BORDER=0 NAME=image " + "onload='window.resizeTo(document.image. width,(document.image.height*1.3))'>" + "</body></html>"; popup=window.open ('','image','toolbar=0,location=0, directories=0,menuBar=0, scrollbars=0,resizable=1'); popup.document.open(); popup.document.write(html); popup.document.focus(); popup.document.close() }; //--></script>

To call the script use a simple link.

<a href="javascript:imagePopUp('../images/yourimage.gif')"'>Click to enlarge</a>

This script is modified code found @ www.rgagnon.com

4 comments ↓

If you found this post useful click the share this button. Contribute below by adding a comment, no registration is required.


  • jkbhkbhb says on 12.23.08 at 5:56 am comment #1

    egerg

  • jkbhkbhb says on 12.23.08 at 6:35 am comment #2

    egytrf

  • izak hason says on 01.02.09 at 11:25 am comment #3

    teşekkürler emeğe saygı..

  • morinek dizayn says on 01.02.09 at 11:27 am comment #4

    Çok teşekkürler başarılı

Leave a Comment