Problem getting onresize to work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Darrel Yurychuk

    Problem getting onresize to work

    I'm having a problem getting the window.onresize to work properly. Here
    is a simple test case I wrote:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Test window.onresize </title>
    <script type="text/javascript">
    function resize_func() {
    alert ('resize_func has been called');
    }
    window.onresize = resize_func();
    </script>
    </head>
    <body>
    <p>Just Some Text</p>
    </body>

    When I load this page in firefox (1.0.6). I get the alert box that pops
    up on initial load, but any subsequent resizing of the window fails to
    trigger the event. It's probably something really simple, but so far
    I'm stumped. Any help would be greatly appreciated. Thanks
    --
    Darrel
  • Lee

    #2
    Re: Problem getting onresize to work

    Darrel Yurychuk said:[color=blue]
    >
    >I'm having a problem getting the window.onresize to work properly. Here
    >is a simple test case I wrote:
    >
    ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    >"http://www.w3.org/TR/html4/strict.dtd">
    ><html>
    ><head>
    ><title>Test window.onresize </title>
    ><script type="text/javascript">
    >function resize_func() {
    > alert ('resize_func has been called');
    >}
    >window.onresiz e = resize_func();[/color]

    That last line executes resize_func() and assigns the return value
    (void, in this case) to window.onresize . If you want to assign a
    reference to your function to window.onresize , leave off the parentheses:

    window.onresize =resize_func;

    Comment

    Working...