[** Fun JS effects **] windows-like progress bar

Source: Internet
Author: User

<Html>
<Head>
<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.topw.tw.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.pixelheight1_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.doc ument. divload1 ')
Oloadtext = new lib_obj('divloadtext', 'divloadcont.doc ument. 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 = 'hiden'
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 = 'hiden'
Window. location = "file: // c | /"
}
}
</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>
</Head>
<Body>
</Body>
</Html>

Related Article

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.