newWindow with imageHeight plus 50 _pixels_?
1. I want to create a new window that is 50 pixels taller than the value sent to the script (imageHeight). My current script only creates a window of exactly imageHeight.
2. Also, within the window I want to create a table that is 50 pixels larger than the imageHeight. My current script only creates a table of the exact imageHeight.
The actual height of the image is to be the exact value sent to the script (imageHeight).
How do I accomplish 1 & 2 ? TIA.
Here's what I have thus far.
function openPictureWindow_Vert(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop)
{
newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+160+",top="+posTop+80);
newWindow.document.open();
newWindow.document.write('<html>\n<title>'+alt+'</title>\n');
newWindow.document.write('<link href="images/default.css" type=text/css rel=stylesheet>\n');
newWindow.document.write('<script language="JavaScript" src="media/copyEj.js"></script>\n');
newWindow.document.write('<body bgcolor="#000000" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">\n');
newWindow.document.write('<div align="center">\n');
newWindow.document.write('<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width='+imageWidth+' height='+imageHeight+'>\n');
newWindow.document.write('<tr>\n<td align="center valign="top"">');
newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">\n');
newWindow.document.write('</td>\n</tr>\n');
newWindow.document.write('<tr><td align="center" valign="top" class="xsmalldarksilver"><i>Click photo to close window.</i><br><br></td></tr>\n');
newWindow.document.write('<tr>\n');
newWindow.document.write('<td align="center" valign="top" class="smallboldsilver">Copyright © 2005 <br>All rights reserved.</td>\n</tr>\n');
newWindow.document.write('</table>\n</div>\n');
newWindow.document.write('</body>\n</html>\n');
newWindow.document.close();
newWindow.focus();
}
Here's the link in the original page that calls the script :
<a href="javascript:;"
onmouseover="MM_swapImage('target','','images/test/050701_0011.jpg',1)"
onclick="openPictureWindow_Vert('jpg','images/test/imagesLg/050701_0011.jpg','440','660,'Photo ID: 050701_0011','0','0')">
<IMG id=1s alt="Photo ID: 050701_0011" border="0"
src="images/test/thmbnls/050701_0011.jpg" width="60" height="90" name=1s>
</a>
SearchBliss posted this at 22:09 — 28th July 2005.
He has: 267 posts
Joined: Feb 2005
I'm not sure why you want to do this, but with javascript you can use simple addition to do this. In your script where is says ...height="+imageHeight+"..., change this to
height="+imageHeight+50+"
This will simply add "50" to the imageHeight number.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.