Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.onresize won't work

Status
Not open for further replies.

chronix

Programmer
Oct 7, 2002
5
0
0
SE
I'm trying to get window.onresize to work but it just won't and i don't understand why.

It works if I put it in body onresize but that's not a possibility for me.

All I get i run this code is the alert onload and nothing if I resize the window.

Please help me

<html>
<head>
<script language=&quot;JavaScript&quot;><!--
window.onresize=window.alert('you resized it');
//--></script>
</head>

<body>

</body>
</html>
 
try this :

window.onresize = function()
{
window.status = ((document.all) ? document.body.offsetHeight : window.innerHeight)
+ &quot; &quot;
+ ((document.all) ? document.body.offsetWidth : window.innerWidth)
}

On a side note using an alert there is the easiest way to get too many alerts all over the place if you do resize your page. Gary Haran
==========================
 
Thanx I solved it like this

window.onresize = ChangeLayer

function ChangeLayer() {
if(document.all)
{
...do this...
}
else if(document.getElementById)
{
...do this...
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top