Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open pic in new window

Status
Not open for further replies.

matrix07

Programmer
Mar 21, 2002
41
0
0
CA
hi there, I have a image gallery as thumbnails on one page, when a thumbnail is clicked I want the full version of the image in a new window with its dimensions. Now I got it working but I don't think this is a effecient way. Any ideas? Thanks. Actually I only have one pic to open but I would like the script to work for multiple thumbnails.


<script language=javascript>
function openPic(url){
newWindow=window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
newWindow.document.write('<html><title></title><head></head>')
newWindow.document.write('<body onLoad=&quot;self.resizeTo(document.images[0].width,document.images[0].height);&quot; topmargin=&quot;0&quot; leftmargin=&quot;0&quot;><img src=&quot;'+url+'&quot;></body></html>')
newWindow.location.reload();
newWindow.focus();
}
</script>


<td colspan=2><a href=&quot;JavaScript:void(0);&quot; onClick=&quot;openPic('images/girl.jpg');&quot; border=0>
<img src=&quot;images/girl_tn.jpg&quot; width=85 height=55 border=0></a></td>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top