<!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" οnlοad="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>
转载于:https://www.cnblogs.com/yansen/archive/2012/03/09/2387845.html