dysfunctionGazz
08-23-2002, 03:18 PM
Does anyone have a nice small code that opens a piccy in a snug window i.e. around the picture, rather than just in a new window? The size would need to be variable.
I've had a script like this before but I had to handcode ALL the image sizes into individual javascript commands for every link and was well tedious.
The code that I have previously found is:
<SCRIPT language="JavaScript">
<!--
function openPicture(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
newWindow.document.open();
newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>');
newWindow.document.write('</body></html>');
newWindow.document.close();
newWindow.focus();
}
//-->
</SCRIPT>
and to open the picture...
<a href="javascript:openPicture('gallery/doleboyatwork.jpg','425','320','DoleBoy','100','100')">
<img src="gallery/small/doleboyatworksmall.jpg" border="0" width="50" height="38" alt=""></a>
any less fiddly way of opening the pic in this nice way?
I've had a script like this before but I had to handcode ALL the image sizes into individual javascript commands for every link and was well tedious.
The code that I have previously found is:
<SCRIPT language="JavaScript">
<!--
function openPicture(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
newWindow.document.open();
newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>');
newWindow.document.write('</body></html>');
newWindow.document.close();
newWindow.focus();
}
//-->
</SCRIPT>
and to open the picture...
<a href="javascript:openPicture('gallery/doleboyatwork.jpg','425','320','DoleBoy','100','100')">
<img src="gallery/small/doleboyatworksmall.jpg" border="0" width="50" height="38" alt=""></a>
any less fiddly way of opening the pic in this nice way?