iframe loading 效果

<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="keywords" content="" />
<meta name="description"  content="" />
<title>iframe  loading 效果</title>
<link rel="stylesheet"  href=" " type="text/css"/>
<script type="text/javascript" src=""></script>
</head>
<body>
<iframe src="http://www.cnblogs.com/yansen/" frameborder="0" marginheight="0" marginwidth="0"
        scrolling="auto" width="100%" id="alarmframe" onreadystatechange="stateChangeIE(this)"
        style="display: none" onload="stateChangeFirefox(this)" ></iframe>
    <div id="LoadDiv" align="center">
        <img src="ajax-loader.gif" />
    </div>
    <script type="text/javascript">
        function stateChangeIE(_frame) {
            if (_frame.readyState == "complete")//state: loading, interactive, complete
            {
                var loader = document.getElementById("LoadDiv");
                //loader.innerHTML = "加载中";
                loader.style.display = "none";
                _frame.style.visibility = "visible";
                _frame.style.display = "block"
            }
        }
        function stateChangeFirefox(_frame) {
            var loader = document.getElementById("LoadDiv");
            //loader.innerHTML = "加载中";
            loader.style.display = "none";
            _frame.style.visibility = "visible";
            _frame.style.display = "block"
        }
    </script>
</body>
</html>

posted @ 2012-03-09 16:36  闫森  阅读(872)  评论(0编辑  收藏  举报