开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜