You are here: irt.org | FAQ | JavaScript | Window | Q1614 [ previous next ]
Try:
<html>
<head>
<title>offer resize</title>
<script language="JavaScript"><!--
var orgw, orgh = 0;
var resized = false;
function getXY() {
if (document.body && document.body.clientWidth) {
orgw = document.body.clientWidth;
orgh = document.body.clientHeight;
}
else if (window.outerWidth) {
orgw = window.outerWidth;
orgh = window.outerHeight;
}
}
function setXY() {
if (resized) top.resizeTo(orgw,orgh);
}
function resize(x, y) {
alert(orgw + ' ' + orgh);
resized = true;
top.resizeTo(x, y);
return false;
}
//--></script>
<body onLoad="getXY()" onUnload="setXY()">
<a href="javascript:;" onClick="return resize(800,600)">800x600</a>
</body>
</html>