IFrame网页加载完成事件

网上别人的写法。

<html>    
<head>    
<script type="text/javascript">
    
var iframe;     
    
function load() {     
        iframe 
= document.getElementById("iframe");     
        iframe. onload 
= iframe. onreadystatechange = iframeload;      
        iframe.src 
= "http://www.baidu.com";     
    }     
    
function iframeload() {     
        
if (!iframe.readyState || iframe.readyState == "complete") {     
            alert(
"Local iframe is now loaded.");     
        }     
    }     
</script>    
</head>    
<body onload="load()">    
    <iframe id="iframe"></iframe>    
</body>    
</html>   

我是直接接在Iframe中添加写OnLoad事件,代码如下:

<script type="text/javascript">
        
//iframe 加载完成
        var iframeLoaded = function (iframe) {
            
if (iframe.src.length > 0) {
                
if (!iframe.readyState || iframe.readyState == "complete") {
                    HideTopWaitPage();
                }
            }
        }
</script>  
<iframe id='ifmArrpove' frameborder='0' width='100%' height='100%' onload='iframeLoaded(this)'}></iframe>


原文地址:https://www.cnblogs.com/scottckt/p/2281916.html