Using HTC to implement progress bar control _HTC

Source: Internet
Author: User
Tags current time
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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.