I am facing problem while resizing an image in the Popup brwoser window.
Image present in popup gets resized when the user resizes the browser window for the first time only, afterwards when the window resizes (dblclicking the titlebar, or using the resize handles) the image dimension remains equal to the last resized dimension.
My code is shown below:
<html>
<head>
<title>Enlarged Image</title>
<script language="javascript" type="text/javascript">
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
var NS = (navigator.appName == "Netscape") ? true : false;
function GetWidth() {
var x = 0;
if (self.innerHeight) {
x = self.innerWidth;
}
else if (document.documentElement && document.documentElement.clientHeight) {
x = document.documentElement.clientWidth;
}
else if (document.body) {
x = document.body.clientWidth;
}
return x;
}
function GetHeight() {
var y = 0;
if (self.innerHeight) {
y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) {
y = document.documentElement.clientHeight;
}
else if (document.body) {
y = document.body.clientHeight;
}
return y;
}
window.onresize = function() { document.write("<img src='" + picUrl + "' border=0 Name=image Width=" + GetWidth() + " Height=" + (GetWidth() * 3) / 4 + "/>") }
</script>
</head>
<body style='margin: 0px; text-align:center;'>
<script language="javascript" type="text/javascript">
document.write("<img src='" + picUrl + "' border=0 Name=image Width=800 Height=600 />");
</script>
</body>
I am passing imgpath to this html file from my aspx file as shjown below:
this.aspHyperlink.NavigateUrl = "javascript:PopupPic('." + this.aspImgCtrl.ImageUrl.Replace('~', '.') + "')";
The javascript PopupPic function is shown below:
function PopupPic(sPicURL) {
window.open("PopupEventImage.htm?" + sPicURL, "", "resizable=1,HEIGHT=600,WIDTH=800");
}
Any ideas for resizing the image every time the user resizes the popup window?