Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

document.onreadystatechange

概述

readystatechange事件会在document.readyState属性发生变化时触发.

语法

document.onreadystatechange = funcRef;

funcRef 是个函数引用,会在readystatechange事件触发时调用.

例子

// 模拟DOMContentLoaded事件
document.onreadystatechange = function () {
    if (document.readyState == "complete") {
        initApplication();
    }
}

相关链接

规范

文档标签和贡献者

 此页面的贡献者: ziyunfei, teoli, khalid32
 最后编辑者: khalid32,