开发者

When document.readystate==complete is that the same when onload fires?

开发者 https://www.devze.com 2023-02-07 05:29 出处:网络
In Internet Explorer, when onreadystatechange is fired, and readystate switches to complete, is that the same time onload event triggers? Have all t开发者_开发知识库he requests completed by this time?

In Internet Explorer, when onreadystatechange is fired, and readystate switches to complete, is that the same time onload event triggers? Have all t开发者_开发知识库he requests completed by this time?


document.onreadystatechange is typically more optimal than window.onload as it fires before all external resources such as images are loaded. However, it's not well supported at the moment (but if you're only concerned with IE, then it's not a problem).

See: https://developer.mozilla.org/en/DOM/document.onreadystatechange

Or, for IE: http://msdn.microsoft.com/en-us/library/ms536957(v=vs.85).aspx


document.readyState is a property and window.onload is an event

http://www.w3schools.com/jsref/prop_doc_readystate.asp

http://www.w3schools.com/js/js_events.asp

0

精彩评论

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