Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2003
    Location
    ROMANIA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Does NetScape has an equivalent of IE's ONRESIZE event?

    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.
    Claudiu Iacob - Romania

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've never heard of onresize for an element; but there is a global window.onresize event:

    window.onresize = doSomething;

  • #4
    New Coder
    Join Date
    Feb 2003
    Location
    ROMANIA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks
    Claudiu Iacob - Romania

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    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;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •