如何判断页面是否加载完毕
如何判断页面是否加载完毕?
function on(){
if ( window.onload )
{
alert( "page onload." );
}
else{
window.setTimeout( on, 1000);
}
}
on();
---------------------------------------------------------------
寻梦草人的代码
<iframe src="http://www.163.com" id="ice"></iframe>
<script language="javascript">
<!--
var frame = document.getElementById("ice");
frame.onreadystatechange = function(){
if( this.readyState == "complete" )
alert('加载完毕!');
}
//-->
</script>
---------------------------------------------------------------
<script>
function loadWindow()
{
if(frm.document.readyState == "complete")
alert("加载完成!");
else
setTimeout("loadWindow()", 500)
}
loadWindow()
</script>
或者
<script>
timer=setInterval(checkload,100)
function checkload(){
if(frmid.readyState!="complete")
{
clearInterval(timer);
alert("加载完毕.")
}
}
</script>