首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

DOMContentLoaded与 onload的差异

2013-11-18 
DOMContentLoaded与 onload的区别1.DOMContentLoadedDOMContentLoaded是FF,Opera 9的特有的Event, 当所有D

DOMContentLoaded与 onload的区别

1.DOMContentLoaded

DOMContentLoaded是FF,Opera 9的特有的Event, 当所有DOM解析完以后会触发这个事件。

?jquery的ready(示例:$("selector).ready(function(){})),MT的onDomReady

?IE下是scrollleft事件可以时就表示DomcontentLoaded: var temp= document.createElement('div');temp.doScroll('left');

?Fired on a Window object when a document's DOMcontent is finished loading, but unlike "load", does not wait untilall images are loaded. Used for example by GreaseMonkey to sneak in to alterpages before they are displayed.

This event, as many others on this page, is dispatched to"trusted" targets only; for example, it is not dispatched to thecontent of the main browser object in Firefox, even if it comes from a chrome:/URI.

?

2.Onload

?onload要等到所有页面元素加载完成才会触发, 包括页面上image、flash、iframe等内容都加载完毕才会执行。

热点排行