简体   繁体   中英

FF4 problem with use window event onResize

We have some problem with FF4 when add event. Look like than our event is catched and freezed. And in final we have gray screen on FF4

<html>
<head>
<script type="text/javascript">
function addEvent(elem, type, eventHandle) {
    if (elem == null || elem == undefined) return;
    if ( elem.addEventListener ) {
        elem.addEventListener( type, eventHandle, false );
    } else if ( elem.attachEvent ) {
        elem.attachEvent( "on" + type, eventHandle );
    }
};

addEvent(window, "resize", function() { alert("hello there!");  } );
</script>
</head>
<body>
test resize page
</body>
</html>

And it`s normal work in IE7, Chrome, FF3

alert("hello there;");

I think it freezes your page. It's called too many times.

See example with input field http://jsfiddle.net/FbEhD/ . It shows how many times event handler is called.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM