用javascript实现的进度条,可用于加载等待,如上传文件等待,加载完页面跳转执行某个操作等等。
<html> <head> <title>php自学网 LOADING</title> <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.phpzixue.cn/"; else { setSB(v, el, infor, "php自学网 http://www.phpzixue.cn加载中……"); window.setTimeout("fakeProgress(" + (v + 1) + ", document.all['" + el.id + "'])", 20); } } </script> </head> <body onload="fakeProgress(0,sb)"> <table width="699"> <td width="691" height="300"> </table> <DIV align=center> <DIV id=sb style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; BACKGROUND: #DCDCDC; 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%" hidden overflow: height:12px;></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> |
|