W
wolfing1
I have the following page that is supposed to self-resize to the
image's dimensions when opened, but for some reason it works fine with
Firefox, but in IE6 it doesn't. I added the alert and it gives me a
wildly different value in both browsers. In Firefox, it tells me the
correct browser dimensions, but in IE it says the wrong dimensions,
i.e., the dimensions of the image and not the browser, so when I do the
substraction later it basically resizes by 0,0 (well, 0, -4 but same
thing).
Can anybody see anything wrong about it?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html40/loose.dtd">
<html>
<head>
<title>Size Chart</title>
<link rel="stylesheet" type="text/css" href="/style.css">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<script language="javascript" type="text/javascript">
var NS = (navigator.appName=="Netscape")?true:false;
function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
alert(iWidth + "." + iHeight);
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight);
self.focus();
};
</script>
</head>
<body onload="FitPic();">
<img src="/img/0.jpg" alt="x">
</body>
</html>
image's dimensions when opened, but for some reason it works fine with
Firefox, but in IE6 it doesn't. I added the alert and it gives me a
wildly different value in both browsers. In Firefox, it tells me the
correct browser dimensions, but in IE it says the wrong dimensions,
i.e., the dimensions of the image and not the browser, so when I do the
substraction later it basically resizes by 0,0 (well, 0, -4 but same
thing).
Can anybody see anything wrong about it?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html40/loose.dtd">
<html>
<head>
<title>Size Chart</title>
<link rel="stylesheet" type="text/css" href="/style.css">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<script language="javascript" type="text/javascript">
var NS = (navigator.appName=="Netscape")?true:false;
function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
alert(iWidth + "." + iHeight);
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight);
self.focus();
};
</script>
</head>
<body onload="FitPic();">
<img src="/img/0.jpg" alt="x">
</body>
</html>