View Full Version : Does NetScape has an equivalent of IE's ONRESIZE event?

03-02-2003, 08:02 PM
I know this is a JS forum and one may say that "OnResize" is merely an HTML atribute.

It may be, but I need the answer for a JavaScript wich rearange the page content related to the available space. This is done via a function - autoPos() called by:

1. <BODY ONLOAD="autoPos()">

and somewhere in the body by

2. <DIV ID = "control" onResize ="autoPos()">

What can I use instead of "onResize" to make that work the same in NetScape?
Anything else works the same in both browsers, just, in NS, the function autoPos() isn't executed when I resize the page.

Hope I was clear.
Thank for any help.

03-02-2003, 10:22 PM
acording to this, no

03-02-2003, 10:42 PM
I've never heard of onresize for an element; but there is a global window.onresize event:

window.onresize = doSomething;

03-03-2003, 10:18 AM

Roy Sinclair
03-03-2003, 07:13 PM
Watch out using the window.onresize event in Netscape 4, one particular version of that browser (NS 4.05) has a bug where it always calls the onresize event when a page first loads so you need to save the original size of the window as the page loads and in the resize event handler check and make sure the size has actually changed.

function NewSize()
if (innerWidth != OriginalWidth || innerHeight != OriginalHeight)
//Place actual resize code here ----------
return true;
var OriginalWidth = innerWidth
var OriginalHeight = innerHeight
if (document.layers) window.onresize = NewSize;