how to use it?
var _bar = new ProcessBar();
_bar.max = 1000;
_bar.value = 200;
//1. document.write(_bar.toString());
//2. _barHandle = _bar.newCreate(control);
//_barHandle.value = 300; _barHandle.refresh();<!--
function WebProcessBar(value, max, width, height){
this.value = value || 0;
this.max = max || 100;
this.width = width || '100%';
this.height = height || '12px';
this.bgColor = '#FFFFCC';
this.fgColor = '#99CC00';
this.border = '1px Solid black'; this.fontSize = '9px';
this.fontColor = 'black';
this.isShowText = true;
this.getObject = null;
this.title = null;
}WebProcessBar.prototype.value
WebProcessBar.prototype.maxWebProcessBar.prototype.width
WebProcessBar.prototype.heightWebProcessBar.prototype.Percent = function(){
return (parseInt(this.value,10)/parseInt(this.max,10)*100);
}WebProcessBar.prototype.bgColor
WebProcessBar.prototype.fgColor
WebProcessBar.prototype.borderWebProcessBar.prototype.fontSize
WebProcessBar.prototype.fontColorWebProcessBar.prototype.isShowText
WebProcessBar.prototype.titleWebProcessBar.prototype.newCreate = function(e){
e.innerHTML = this.toString();
this.getObject = e.children(0);
}WebProcessBar.prototype.toString = function(){
var sHtml = '<div '+(this.title == null ? '':'title="'+this.title+'" ')+
'style="'+
'width: '+this.width+'; '+
'height: '+this.height+'; '+
'border: '+this.border+'; '+
'background-color: '+this.bgColor+';">'+
'<table border="0" cellspacing="0" cellpadding="0" style="position: absolute; width: 100%; height: 100%;">'+
'<tr><td align="center" valign="middle" style="'+
'font-size: '+this.fontSize+'; '+
'color: '+this.fontColor+';">'+
(this.isShowText ? this.value+'/'+this.max : '')+'</td></tr></table>'+
'<div style="'+
'width: '+this.Percent()+'%; '+
'height: 100%; '+
'background-color: '+this.fgColor+';"><span></span></div></div>';
return sHtml;
}WebProcessBar.prototype.refresh = function(){if (this.getObject != null) this.newCreate(this.getObject.parentElement);}
//-->
var _bar = new ProcessBar();
_bar.max = 1000;
_bar.value = 200;
//1. document.write(_bar.toString());
//2. _barHandle = _bar.newCreate(control);
//_barHandle.value = 300; _barHandle.refresh();<!--
function WebProcessBar(value, max, width, height){
this.value = value || 0;
this.max = max || 100;
this.width = width || '100%';
this.height = height || '12px';
this.bgColor = '#FFFFCC';
this.fgColor = '#99CC00';
this.border = '1px Solid black'; this.fontSize = '9px';
this.fontColor = 'black';
this.isShowText = true;
this.getObject = null;
this.title = null;
}WebProcessBar.prototype.value
WebProcessBar.prototype.maxWebProcessBar.prototype.width
WebProcessBar.prototype.heightWebProcessBar.prototype.Percent = function(){
return (parseInt(this.value,10)/parseInt(this.max,10)*100);
}WebProcessBar.prototype.bgColor
WebProcessBar.prototype.fgColor
WebProcessBar.prototype.borderWebProcessBar.prototype.fontSize
WebProcessBar.prototype.fontColorWebProcessBar.prototype.isShowText
WebProcessBar.prototype.titleWebProcessBar.prototype.newCreate = function(e){
e.innerHTML = this.toString();
this.getObject = e.children(0);
}WebProcessBar.prototype.toString = function(){
var sHtml = '<div '+(this.title == null ? '':'title="'+this.title+'" ')+
'style="'+
'width: '+this.width+'; '+
'height: '+this.height+'; '+
'border: '+this.border+'; '+
'background-color: '+this.bgColor+';">'+
'<table border="0" cellspacing="0" cellpadding="0" style="position: absolute; width: 100%; height: 100%;">'+
'<tr><td align="center" valign="middle" style="'+
'font-size: '+this.fontSize+'; '+
'color: '+this.fontColor+';">'+
(this.isShowText ? this.value+'/'+this.max : '')+'</td></tr></table>'+
'<div style="'+
'width: '+this.Percent()+'%; '+
'height: 100%; '+
'background-color: '+this.fgColor+';"><span></span></div></div>';
return sHtml;
}WebProcessBar.prototype.refresh = function(){if (this.getObject != null) this.newCreate(this.getObject.parentElement);}
//-->
<HTML xmlns:v>
<HEAD>
<META http-equiv='Content-Type' content='text/html;charset=gb2312'>
<Meta name='Gemeratpr' content='网络程序员伴侣(Lshdic)2004'>
<TITLE>效果不错的VML进度条</TITLE>
<STYLE>
v\:*{behavior:url(#default#VML);}
*{font-size:12px;color:;}
</STYLE>
</HEAD>
<BODY topmargin='2' leftmargin='2'>
<div style='table-Layout:fixed;width:100%;height:100%;border:1 solid black'>
<v:RoundRect id='a' style='position:absolute;left:300;top:250;height:29;'>
<v:Textbox inset='5px,5px,5px'><b><font color='red' id='jindu'></font></b></v:textbox>
<v:fill type='gradient' id='fill1' color='blue'/>
</v:RoundRect>
</div>
<script>
//原作:风云舞,载自:http://www.lshdic.com/bbs
var pos1=1,posall=200 //定义全局变量,pos1为当前进度,posall为总进度
function play1(){ //播放函数
if(pos1<posall)pos1+=1;else{pos1=1;fill1.color="rgb("+Math.round(Math.random()*255)+","+Math.round(Math.random()*255)+","+Math.round(Math.random()*255)+")"}
a.style.width=Math.round(300/(posall/pos1));jindu.innerText=pos1+"/"+posall+","+Math.round(100/(posall/pos1))+"%"
fill1.angle=Math.round(300/(posall/pos1))
}
setInterval("play1()",10) //10毫秒播放一次,一般CPU保证能消化~~~
</script>
</BODY>
</HTML>
<HTML xmlns:v>
<HEAD>
<META http-equiv='Content-Type' content='text/html;charset=gb2312'>
<Meta name='Gemeratpr' content='网络程序员伴侣(Lshdic)2004'>
<TITLE></TITLE>
<STYLE>
v\:*{behavior:url(#default#VML);}
*{font-size:12px;color:;}
</STYLE>
</HEAD>
<BODY topmargin='2' leftmargin='2'>
<table width="100%"><tr><td> </td></tr><tr><td> 正在加载..............</td></tr><tr><td>
<div style='table-Layout:fixed;width:40%;height:100%;border:1 solid black;position:absolute;left:30;top:40;height:23;'>
<div style='table-Layout:fixed;width:100%;height:100%;border:1 solid black;'>
<v:RoundRect id='a' style='position:absolute;left:0;top:0;height:20;'>
<v:Textbox inset='5px,5px,5px'><b><font color='#333333' id='jindu'></font></b></v:textbox>
<v:fill type='gradient' id='fill1' color='#ddddd5'/>
</v:RoundRect>
</div>
</div></td></tr></table>
<script>
var pos1=1,posall=200 //定义全局变量,pos1为当前进度,posall为总进度
function play1(){ //播放函数
if(pos1<posall)pos1+=1;else{pos1=1;fill1.color="#ddddd5"}
a.style.width=Math.round(300/(posall/pos1));
jindu.innerText=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
}
setInterval("play1()",10) //10毫秒播放一次,一般CPU保证能消化~~~
</script>
</BODY>
</HTML>
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<style>
<!--
#bar, #barbackground{
position:absolute;
left:0;
top:0;
background-color:blue;
}
#barbackground{
background-color:black;
}
-->
</style>
<script language="JavaScript1.2">
var duration=5
function postaction(){
}
var clipright=0
var widthIE=0
var widthNS=0
function initializebar(){
if (document.all){
baranchor.style.visibility="visible"
widthIE=bar.style.pixelWidth
startIE=setInterval("increaseIE()",50)
}
if (document.layers){
widthNS=document.baranchorNS.document.barbackgroundNS.clip.width
document.baranchorNS.document.barNS.clip.right=0
document.baranchorNS.visibility="show"startNS=setInterval("increaseNS()",50)
}
}
function increaseIE(){
bar.style.clip="rect(0 "+clipright+" auto 0)"
window.status="Loading..."
if (clipright<widthIE)
clipright=clipright+(widthIE/(duration*20))
else{
window.status=''
clearInterval(startIE)
postaction()
}
}
function increaseNS(){
if (clipright<202){
window.status="Loading..."
document.baranchorNS.document.barNS.clip.right=clipright
clipright=clipright+(widthNS/(duration*20))
}
else{
window.status=''
clearInterval(startNS)
postaction()
}
}
window.onload=initializebar
</script>
</head>
<body bgcolor="#FFFFFF">
<script language="JavaScript1.2">
if (document.all){
document.write('<div id="baranchor" style="position:relative;width:200px;height:20px;visibility:hidden;">')
document.write('<div id="barbackground" style="width:200px;height:20px;z-index:9"></div>')
document.write('<div id="bar" style="width:200px;height:20px;z-index:10"></div>')
document.write('</div>')
}
</script>
<ilayer name="baranchorNS" visibility="hide" width=200 height=20>
<layer name="barbackgroundNS" bgcolor=black width=200 height=20 z-index=10 left=0 top=0></layer>
<layer name="barNS" bgcolor=blue width=200 height=20 z-index=11 left=0 top=0></layer>
</ilayer>
</body>
</html>
使他们不刷新页面
建议楼主换个方案