...

View Full Version : enlarging images



Joser
02-28-2005, 05:49 AM
if i have an image around 100 width and 100 height
is there a way to click on the image to enlarge without making a new html page, just enlarging it on same page with new window? and if so , can i have the code?

thnx

_Aerospace_Eng_
02-28-2005, 06:53 AM
put this in your head tags of the page with the thumbnails

<script type="text/javascript">
function largeimg(title,image1,wid,hgt){
sw=(screen.width-wid)/2;
sh=(screen.height-hgt)/2;
newwin=window.open('','newwin','width='+wid+',height='+hgt+',menubars=0,toolbars=0,scrollbars=0,loca tion=0,directories=0,left='+sw+',top='+sh+'');
newwin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"');
newwin.document.write('"http://www.w3.org/TR/html4/loose.dtd">');
newwin.document.write('<html><head><title>'+title+'</title>');
newwin.document.write('<style type="text/css">');
newwin.document.write('html,body{margin:0px;padding:0px;}');
newwin.document.write('</style>');
newwin.document.write('</head><body>');
newwin.document.write('<img src="'+image1+'" width="'+wid+'" height="'+hgt+'" alt="">');
newwin.document.write('</body></html>');
}
</script>
then in your body tags is where you should have the thumbnail, set up your thumbnails like this

<a href="largerimage.jpg" target="_blank" onclick="largeimg('Large Image','largerimage.jpg','400','400');return false"><img src="smallerimage.jpg" style="border:0px;"></a>
red is the title that you want the popup window to have
green is the image you want to popup
magenta is the width you want the larger image to be
lime is the height you want the larger image to be
navy is the thumbnail image

Joser
02-28-2005, 07:54 PM
thank you



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum