IFrame网页加载完成事件

代码如下:

<script type="text/javascript">
        //iframe 加载完成
 var iframeLoaded = function (iframe) {
   
if (iframe.src.length > 0) {    if (!iframe.readyState || iframe.readyState == "complete") {       alert("调用iframe的方法");    }    } } </script> <iframe id='ifmArrpove' frameborder='0' width='100%' height='100%' onload='iframeLoaded(this)'></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>

 

posted @ 2014-12-12 11:54  贝壳风铃  阅读(2866)  评论(0)    收藏  举报