Difference between load vs DOMContentLoaded

Possible Duplicate:
Difference between DOMContentLoaded and Load events

Whats the difference between

window.addEventListener("load", load, false);

and

document.addEventListener("DOMContentLoaded", load, false);

?


  • DOMContentLoaded - the whole document (HTML) has been loaded.
  • load - the whole document and its resources (eg images, iframes, scripts) have been loaded.

  • DOMContentLoaded awaits only for HTML and scripts to be loaded.
    window.onload and iframe.onload triggers when the page is fully loaded with all dependent resources including images and styles.

    Here is more details you can find http://javascript.info/tutorial/onload-ondomcontentloaded

    链接地址: http://www.djcxy.com/p/83326.html

    上一篇: 将HTML字符串转换为DOM元素?

    下一篇: 负载与DOMContentLoaded之间的区别