开发者

What is wrong with this page onload code?

开发者 https://www.devze.com 2023-03-24 14:09 出处:网络
Please see this jsFiddle. Note that the click event works just fine (try clicking anyw开发者_StackOverflow社区here in the output), but not the document load event.The document requires DOMContentLoade

Please see this jsFiddle. Note that the click event works just fine (try clicking anyw开发者_StackOverflow社区here in the output), but not the document load event.


The document requires DOMContentLoaded.

_bl_event(document, 'DOMContentLoaded', d1, false);
_bl_event(document, 'DOMContentLoaded', d2, false);

...though it isn't supported in all browsers.

Example: http://jsfiddle.net/bCtQQ/15/

This has different meaning from placing a load handler on window.


Ach, I finally got it — attaching the event to window instead of document seems to work much better.

0

精彩评论

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