来源:ITPOW(www.itpow.com)
正式版已经推出,支持多种浏览器,点击这里进入。
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>进度条</title> </head> <body> <div> <a href="http://www.itpow.com/" target="_blank">ITPOW www.itpow.com 专业探讨【ASP、JavaScript、XHTML+CSS、SQL Server】</a> <hr> </div> <div id="progress"></div> <script type="text/javascript" language="javascript"> <!-- function CProgress(progressIdStr, min, max, pos) { this.progressIdStr = progressIdStr; this.progressId = document.getElementById(this.progressIdStr); this.barIdStr = progressIdStr + "_bar"; this.barId = null; this.min = (min>=0)?min:0; this.max = (max>=min)?max:min; this.pos = (pos>=min && pos<=max)?pos:min; this.step = 1; this.progressWidth = 100; this.progressHeight = 15; this.Create = Create; this.SetStep = SetStep; this.SetPos = SetPos; this.Inc = Inc; this.Desc = Desc; } function Create() { if (document.all) { this.progressId.style.width = this.progressWidth+2; } else { this.progressId.style.width = this.progressWidth; } this.progressId.style.height = this.progressHeight; this.progressId.style.fontSize = this.progressHeight; this.progressId.style.border = "1px solid #000000"; this.progressId.innerHTML = "<div id=\"" + this.barIdStr + "\" style=\"background-color:#006699;height:100%;\"></div>"; this.barId = document.getElementById(this.barIdStr); this.SetPos(this.pos); } function SetStep(step) { this.step = step; } function SetPos(pos) { pos = (pos<=this.max)?pos:this.max; pos = (pos>=this.min)?pos:this.min; this.barId.style.width = (this.progressWidth*pos)/this.max; } function Inc() { this.pos += this.step; this.SetPos(this.pos); } function Desc() { this.pos -= this.step; this.SetPos(this.pos); } var progress = new CProgress("progress", 0, 1000, 50); progress.progressWidth = 600; progress.Create(); setInterval("progress.Inc();", 10); //--> </script> </body> </html>[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
创建于2005年 渝ICP备05010272号-1
电邮:cftea@126.com