求带进度条的js

j2selove 2007-11-15 06:39:41
如题
...全文
50 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
iskyshop 2007-11-15
  • 打赏
  • 举报
回复
<HTML>
<HEAD>
<TITLE>yaosansi</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
</HEAD>
<BODY BGCOLOR="#EAEAEA">


<form name=loading>
<table border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
<tr>
<TD align="center" valign="top">
<p><FONT color="000000" face="Arial"><BR>
页面载入中,请等待</FONT></p>
<p><input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:black; background-color:#EAEAEA; padding:0px; border-style:none;">
<br>
<input type=text name=percent size=46 style="font-family:Arial; color:black; background-color:#EAEAEA;text-align:center; border-width:medium; border-style:none;">
<script>var bar = 0
var line = "||"
var amount ="||"
count()
function count(){
bar= bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.percent.value=bar+"%"
if (bar<99)
{setTimeout("count()",200);}
else
{window.location = "http://www.yaosansi.com/";;}
}
</script></p></TD>
</tr>
</table>
</FORM>
</BODY>
</HTML>
iskyshop 2007-11-15
  • 打赏
  • 举报
回复
<style type="text/css">
#divLoadCont{position:absolute; z-index:500; left:0; top:0; width:100%; height:98%; clip:rect(0,100%,100%,0); background-color:transparent; layer-background-color:white; }
#divLoad1{position:absolute; layer-background-color:silver; background-color:silver}
#divLoad2{position:absolute; left:0; top:0; layer-background-color:navy; background-color:navy}
#divLoadText{position:absolute; background-color:transparent; font-family:arial,helvetica; color:Navy; font-size:14px; }
</style>
<script language="JavaScript" type="text/javascript">
function lib_bwcheck(){ //Browsercheck (needed)
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=this.agent.indexOf("Opera 5")>-1
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
return this
}
var bw=new lib_bwcheck()
numImages=20 //速度
loaderWidth=300 //进度条长度

currentImg=0
function lib_doc_size(){
this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;
this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;
if(!this.x2||!this.y2) return message('Document has no width or height')
this.x50=this.x2/2;this.y50=this.y2/2;
return this;
}
function lib_obj(obj,nest){
nest=(!nest) ? "":'document.'+nest+'.'
this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;
this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt;
this.ref=this.css
this.w=this.evnt.offsetWidth||this.css.clip.width||
this.ref.width||this.css.pixelWidth||0;
return this
}
lib_obj.prototype.moveIt = function(x,y){
this.x=x;this.y=y; this.css.left=x;this.css.top=y
}
lib_obj.prototype.clipTo = function(t,r,b,l,setwidth){
this.ct=t; this.cr=r; this.cb=b; this.cl=l
if(bw.ns4){
this.css.clip.top=t;this.css.clip.right=r
this.css.clip.bottom=b;this.css.clip.left=l
}else{
if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0
this.css.clip="rect("+t+","+r+","+b+","+l+")";
if(setwidth){this.css.pixelWidth=this.css.width=r;
this.css.pixelHeight=this.css.height=b}
}
}
var oLoad2
function startLoading(){
page=new lib_doc_size()
oLoadCont=new lib_obj('divLoadCont')
oLoad=new lib_obj('divLoad1','divLoadCont')
oLoad2=new lib_obj('divLoad2','divLoadCont.document.divLoad1')
oLoadText=new lib_obj('divLoadText','divLoadCont.document.divLoad1')
oLoad.moveIt(page.x50-loaderWidth/2,page.y50-20)
oLoadText.moveIt(loaderWidth/2 - oLoadText.w/2,10)
oLoad.clipTo(0,loaderWidth,40,0,1)
oLoad2.per = loaderWidth/numImages
}
function loadIt(ok){
currentImg++
if(oLoad2) oLoad2.clipTo(0,oLoad2.per*currentImg,40,0,1)
if(!ok){
oLoadCont.css.visibility='hidden'
oLoadCont=null; oLoad1=null; oLoad2=null;
}
}
function loadIt_display(ok){
currentImg++
if(oLoad2) oLoad2.clipTo(0,oLoad2.per*currentImg,40,0,1)
if(currentImg<=numImages) setTimeout("loadIt_display(1)",200)
else{
oLoadCont.css.visibility='hidden'
window.location="http://www.yaosansi.com/"
}
}
</script>
<div id="divLoadCont">
<div id="divLoad1">
<div id="divLoad2"></div><br>
<div id="divLoadText">Loading...</div>
</div>
</div>
<script>
startLoading()
//onload=loadIt; //- LEAVE THIS LINE WHILE TESTING. UNCOMMENT WHEN READY
loadIt_display(1) //LEAVE THIS LINE WHILE TESTING. Delete WHEN READY
</script>
iskyshop 2007-11-15
  • 打赏
  • 举报
回复
<head>

<title>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.yaosansi.com/";
else {
setSB(v, el, infor, "yaosansi's Blog http://www.yaosansi.com加载中……");
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>

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧