标签:callback ack false stc nbsp hang on() bsp listener
dom树加载完毕
$(document).ready()
//原生写法
document.ready = function (callback) {
///兼容FF,Google
if (document.addEventListener) {
document.addEventListener(‘DOMContentLoaded‘, function () {
document.removeEventListener(‘DOMContentLoaded‘, arguments.callee, false);
callback();
}, false)
}
//兼容IE
else if (document.attachEvent) {
document.attachEvent(‘onreadytstatechange‘, function () {
if (document.readyState == "complete") {
document.detachEvent("onreadystatechange", arguments.callee);
callback();
}
})
}
else if (document.lastChild == document.body) {
callback();
}
}
页面全部(包括图片)加载完毕
$(window).load()
//原生
window.onload=function(){
}
标签:callback ack false stc nbsp hang on() bsp listener
原文地址:http://www.cnblogs.com/norcoA3/p/6042544.html