你的位置:
问答吧
-> HTML/CSS
-> 问题详情
HTML中使用Embed或Object标签,如何判断资源已经加载完毕
如题。举个例子:
onafterupdate="printOut()"
我进入页面时,希望加载一个资源,当我知道它加载完后,我会调用JS来打印该资源。但问题就是我现在不知道他什么时候才会加载完。所有想问一下各位,Object或Embed标签有没有加载完成后的事件。谢谢了!
作者: swordsingle
发布时间: 2009-12-23
HTML code
JScript code
functionstateChange(obj){if(obj.readyState==4){//也有可能是2,没试过,LZ自己试下alert("加载完成!");
}
}
PS:readyState状态说明:
Integer that receives one of the following values.
0 Object is not initialized with data.
1 Object is loading its data.
2 Object has finished loading its data.
3 User can interact with the object even though it is not fully loaded.
4 Object is completely initialized.
作者: lihui_shine</