Copy Code code as follows:
<PUBLIC:COMPONENT>
<public:method NAME = "Init" InternalName = "Fncreateprogressbar"/>
<public:method NAME = "showprogress" InternalName = "showprogress"/>
<public:property name= "Container"/>
<public:property name= "Speed"/>
<script language=javascript>
var starttime = null;
function Fncreateprogressbar () {
now = new Date ();
StartTime = Now.gettime ();
now = null
Ocontainer = element. Container
ocontainer.innerhtml = "";
Odiv = Window.document.createElement ("DIV")
Odiv.classname = "Progress"
Ocontainer.appendchild (Odiv)
ODiv.style.display = "";
Element.bar = Odiv;
}
function Pause (numbermillis) {
var dialogscript =
' Window.settimeout (' +
' function () {window.close ();}, ' + Numbermillis + ');
var result =
window.showModalDialog (
' Javascript:document.writeln (' +
' <script> ' + dialogscript + ' < ' + '/script> ');
}
function ShowProgress (STATESDESC) {
now = new Date ();
Currtime = Now.gettime ();
now = null
if (statesdesc!=null) window.status = statesdesc+ "Current time Consuming:" + (Currtime-starttime) + "milliseconds!";
Element.bar.style.width = (currtime-starttime)/element. Speed;
Pause (1)
}
</script>
</PUBLIC:COMPONENT>
Application Example:
Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Progress bar Test </title>
<link rel= "stylesheet" type= "Text/css" href= "Progressbar.css" >
<script>
function Demo () {
Prgbar.container = Document.all.layer1
Prgbar.init ();
for (Var i=0;i<500;i++) {
if (i%5==0) prgbar.showprogress ("Operation in progress ...")
}
Prgbar.showprogress ("Operation complete!")
}
</script>
<body>
<div style= "Position:absolute; width:612px; height:19px; Z-index:1; left:10px; top:72px; Border-style:solid; border-width:1px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px "id=" Layer1 "></div>
<p><input type= "button" value= "Test" name= "B3" onclick= "Demo ()" ></p>
<progressbar id= "Prgbar" class= "ProgressBar" speed= "ten"/>
</body>
Style file: progressbar.css
Copy Code code as follows:
. ProgressBar
{
behavior: url ("PROGRESSBAR.HTC")
}
. progress{
&nb sp; position: relative;
width: 0px;
height: 20px;
z-index: 1;
background-color: #006699;
filter:progid:dximagetransform.microsoft.gradient (startcolorstr= #006699, Endcolorstr= #E3EFFF, gradienttype=0);
border: 1px ridge #C0C0C0;
}