<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>js显示网页载入进度的等待效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<script type="text/javascript">
<!--
var ie5 = (document.all && document.getElementsByTagName);
var step = 0;
function setSB(v, el, inforEl, message) {
if (ie5 || document.readyState == "complete") {
filterEl = el.children[0];
valueEl = el.children[1];
if (filterEl.style.pixelWidth > 0) {
var filterBackup = filterEl.style.filter;
filterEl.style.filter = "";
filterEl.style.filter = filterBackup;
}
filterEl.style.width = v + "%";
valueEl.innerText = v + "%";
inforEl.innerText = message;
}
}
function setSBByStep(v, el, inforEl, message) {
if (ie5 || document.readyState == "complete") {
step = step + v;
filterEl = el.children[0];
valueEl = el.children[1];
if (filterEl.style.pixelWidth > 0) {
var filterBackup = filterEl.style.filter;
filterEl.style.filter = "";
filterEl.style.filter = filterBackup;
}
filterEl.style.width = step + "%";
valueEl.innerText = step + "%"
inforEl.innerText = message;
}
}
function fakeProgress(v, el) {
if (v >= 101)
location.href="http://www.aaa.com";
else {
setSB(v, el, infor, "欢迎访问“教程网”,页面载入中,请稍候……");
window.setTimeout("fakeProgress(" + (v + 1) + ", document.all[’" + el.id + "’])", 50);//等待5秒
}
}
//-->
</script>
</head>
<!--把<body>改为-->
<body onload="fakeProgress(0,zzsky)">
<!--把下面代码加到<body>与</body>之间-->
<div align="center">
<div id="zzsky" style="border-right: #ffffff 1px solid; border-top: #ffffff 1px solid; background: #99ccff; border-left: medium none; width: 400px; border-bottom: #cccccc 1px solid; height: 14px; text-align: left">
<div id="sbChild1" style="filter: alpha(opacity=0, finishopacity=80, style=1, startx=0, starty=0, finishx=100, finishy=0); overflow: hidden; width: 100%; position: absolute; height: 12px">
<div style="background: #000000; width: 100% ;height:12px; overflow: hidden"></div>
</div>
<div style="font-size: 10px; width: 400px; color: white; font-family: arial; position: absolute; height: 14px; text-align: center"></div>
</div>
<p></p>
<div id="infor" style="font-size: 11px; width: 100%; color: #999999; font-family: arial; position: relative; height: 14px; text-align: center"></div>
</div>
</body>
</html>