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'].c lientWidth ;
var height = document.all['contents'].c lientHeigh t;
window.resizeTo(width +10, height +25);
}
</script>
</head>
<body onLoad="init()">
Thanks
bert
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'].c
var height = document.all['contents'].c
window.resizeTo(width +10, height +25);
}
</script>
</head>
<body onLoad="init()">
Thanks
bert
If 'contents' is an id, change all instances of document.all['contents'] to document.getElementById('c ontents')
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or you can use:
screen.width
screen.height
these return entire width and height of the actual cumputer screen
screen.width
screen.height
these return entire width and height of the actual cumputer screen
ASKER
Thanks, works good.
But as that window is refreshed it shrinks a little each time.
Do you know why?
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)