Link to home
Start Free TrialLog in
Avatar of bertmn
bertmn

asked on

Javascript window resize for Netscape.

Hi I've been using this script (below) to autosize a popup window.
But this script only works in IE, I need it to work in IE and Netscape.
So I need this altered to work or a similar script that will work for both.

<script type="text/javascript">
function init(){

var width  =  document.all['contents'].clientWidth;
var height =  document.all['contents'].clientHeight;
window.resizeTo(width +10, height +25);

}
</script>
</head>

<body onLoad="init()">

Thanks
bert
Avatar of StormyWaters
StormyWaters
Flag of United States of America image

If 'contents' is an id, change all instances of document.all['contents'] to document.getElementById('contents')
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or you can use:

screen.width
screen.height

these return entire width and height of the actual cumputer screen

Avatar of bertmn
bertmn

ASKER

Thanks, works good.

But as that window is refreshed it shrinks a little each time.
Do you know why?
Thx for the points. One of the them does not include the toolbars/scrollbars (can not remmeber which one), try outerWidth as well. If you just want to increase the window size by an amount use window.resizeBy(10,25)