Hello
I use the following code to open a pop-up window and load an image. I send the image size details so that the pop-up window is the right dimensions.
My problem is that if you dont close the window when you click another pop-up it does not change the dimensions, so the image does not fit.
How do I either 1) force it to change the size or 2) close the open window and open a new one.
<SCRIPT LANGUAGE="JavaScript">
//Script to open a new HTML page in a window showing a close up of picture.
function openImage(imagepath,imagename,windowname,width,height,features)
{
width=(width)?width:screen.width/2;
height=(height)?height:screen.height/2;
var screenX = (screen.width/2 - width/2);
var screenY = (screen.height/2 - height/2);
var features= "width=" + width + ",height=" + height +",scrollbars=no,status=no";
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY + ",top=" + screenY;
OpenWindow=window.open("", windowname, features);
OpenWindow.document.write("<TITLE>" + imagename + "</TITLE>"
OpenWindow.document.write("<BODY BGCOLOR=#000000 onload='self.focus();'>"
OpenWindow.document.write("<h3><font color=\"white\">" + imagename + "</font></h3>"
OpenWindow.document.write("<P><font color=\"white\">This is a close up of the image you requested.</font></P>"
//OpenWindow.document.write("<img src='" + imagepath + "' width = 200>"
OpenWindow.document.write("<P><img src='" + imagepath + "'></P>"
OpenWindow.document.write("</BODY>"
OpenWindow.document.write("</HTML>"
OpenWindow.document.close()
self.name="main"
}
</SCRIPT>
I use the following code to open a pop-up window and load an image. I send the image size details so that the pop-up window is the right dimensions.
My problem is that if you dont close the window when you click another pop-up it does not change the dimensions, so the image does not fit.
How do I either 1) force it to change the size or 2) close the open window and open a new one.
<SCRIPT LANGUAGE="JavaScript">
//Script to open a new HTML page in a window showing a close up of picture.
function openImage(imagepath,imagename,windowname,width,height,features)
{
width=(width)?width:screen.width/2;
height=(height)?height:screen.height/2;
var screenX = (screen.width/2 - width/2);
var screenY = (screen.height/2 - height/2);
var features= "width=" + width + ",height=" + height +",scrollbars=no,status=no";
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY + ",top=" + screenY;
OpenWindow=window.open("", windowname, features);
OpenWindow.document.write("<TITLE>" + imagename + "</TITLE>"
OpenWindow.document.write("<BODY BGCOLOR=#000000 onload='self.focus();'>"
OpenWindow.document.write("<h3><font color=\"white\">" + imagename + "</font></h3>"
OpenWindow.document.write("<P><font color=\"white\">This is a close up of the image you requested.</font></P>"
//OpenWindow.document.write("<img src='" + imagepath + "' width = 200>"
OpenWindow.document.write("<P><img src='" + imagepath + "'></P>"
OpenWindow.document.write("</BODY>"
OpenWindow.document.write("</HTML>"
OpenWindow.document.close()
self.name="main"
}
</SCRIPT>