<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function TProgressBar(idstr,x,y,w,h,c,bgc,max,min)
{
this.idstr=idstr||"mypb";
this.obj=null;
this.min=min||0;
this.max=max||100;
this.x=x||100;
this.y=y||100;
this.width=w||204;
this.height=h||24;
this.color=c||"#FF6600";
this.bgcolor=bgc||"#E1E1E1";
this.pos=0;
this.percent=0;
this.Create=TProgressBar_Create;
this.Update=TProgressBar_Update;
this.Reposition=TProgressBar_Reposition;
}
function TProgressBar_Update()
{
this.percent=Math.floor(this.pos/this.max*100);
if(this.percent>=100)
{
this.percent=100;
this.obj.width=this.width-4;
}
else
{
this.obj.width=Math.floor(this.pos/this.max*(this.width-4));
}
this.counter.innerHTML=String(this.percent)+"%";
}
function TProgressBar_Create()
{
var str="";
str+='<div id="'+this.idstr+'_border" style="position:absolute; left:'+this.x+'px; top:'+this.y+'px; width:'+this.width+'px; height:'+this.height+'px; z-index:1; background-color: #000000;">';
str+='<div id="'+this.idstr+'_bg" style="position:absolute; left:1px;top:1px;width:'+(this.width-2)+'px; height:'+(this.height-2)+'px; z-index:2; background-color: '+this.bgcolor+';">';
str+='<div id="'+this.idstr+'_main" style="position:absolute; left:1px; top:1px; width:1px; height:'+(this.height-4)+'px; z-index:3; background-color: '+this.color+';font-size:1px"></div>';
str+='<div id="'+this.idstr+'_counter" style="position:absolute;width:10px;height:'+(this.height-4)+'px;left:'+(this.width/2-10)+'px;top:1px;z-index:3">0%</div>';
str+='</div></div>';
document.write(str);
this.obj=document.all[this.idstr+"_main"].style;
this.counter=document.all[this.idstr+"_counter"];
}
function TProgressBar_Reposition()
{
this.pos=0;
//this.max=100;
this.Update();
}
var PB=new TProgressBar("mypb")
PB.Create()
PB.max=100;
function test(){
//for(i=0;i<5;++i){
PB.pos++;
// }
PB.Update();
if(PB.percent!=100)setTimeout("test();",100);
}
//-->
</SCRIPT>
<input type=button οnclick="test()" value=add>
<input type=button οnclick="PB.Reposition()" value=clear>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function TProgressBar(idstr,x,y,w,h,c,bgc,max,min)
{
this.idstr=idstr||"mypb";
this.obj=null;
this.min=min||0;
this.max=max||100;
this.x=x||100;
this.y=y||100;
this.width=w||204;
this.height=h||24;
this.color=c||"#FF6600";
this.bgcolor=bgc||"#E1E1E1";
this.pos=0;
this.percent=0;
this.Create=TProgressBar_Create;
this.Update=TProgressBar_Update;
this.Reposition=TProgressBar_Reposition;
}
function TProgressBar_Update()
{
this.percent=Math.floor(this.pos/this.max*100);
if(this.percent>=100)
{
this.percent=100;
this.obj.width=this.width-4;
}
else
{
this.obj.width=Math.floor(this.pos/this.max*(this.width-4));
}
this.counter.innerHTML=String(this.percent)+"%";
}
function TProgressBar_Create()
{
var str="";
str+='<div id="'+this.idstr+'_border" style="position:absolute; left:'+this.x+'px; top:'+this.y+'px; width:'+this.width+'px; height:'+this.height+'px; z-index:1; background-color: #000000;">';
str+='<div id="'+this.idstr+'_bg" style="position:absolute; left:1px;top:1px;width:'+(this.width-2)+'px; height:'+(this.height-2)+'px; z-index:2; background-color: '+this.bgcolor+';">';
str+='<div id="'+this.idstr+'_main" style="position:absolute; left:1px; top:1px; width:1px; height:'+(this.height-4)+'px; z-index:3; background-color: '+this.color+';font-size:1px"></div>';
str+='<div id="'+this.idstr+'_counter" style="position:absolute;width:10px;height:'+(this.height-4)+'px;left:'+(this.width/2-10)+'px;top:1px;z-index:3">0%</div>';
str+='</div></div>';
document.write(str);
this.obj=document.all[this.idstr+"_main"].style;
this.counter=document.all[this.idstr+"_counter"];
}
function TProgressBar_Reposition()
{
this.pos=0;
//this.max=100;
this.Update();
}
var PB=new TProgressBar("mypb")
PB.Create()
PB.max=100;
function test(){
//for(i=0;i<5;++i){
PB.pos++;
// }
PB.Update();
if(PB.percent!=100)setTimeout("test();",100);
}
//-->
</SCRIPT>
<input type=button οnclick="test()" value=add>
<input type=button οnclick="PB.Reposition()" value=clear>
</BODY>
</HTML>