隨筆-5  評論-22  文章-35  trackbacks-0
          <div style="background: url('http://screenprint2007.cpp114.com/UserFiles/20070412155452218.gif') no-repeat;text-align:center;width:256px;height:18px;position:absolute;top:110;left:10;font-size:13px">
          <div id="proc" style="background: url('http://screenprint2007.cpp114.com/UserFiles/20070412155424937.gif');position:absolute;top:0;left:0;width:0px;height:18px;font-size:13px"></div>
          <div style="position:absolute;top:2;left:0;width:256px;height:18px;text-align:center;font-size:13px;background:transparent">&nbsp;</div>
          </div>
          <br><br><br><br><br><br>
          <input type="button" value="start" onclick="processBar.changeMode();if(processBar.isMoving){this.value='Stop';}else{this.value='Start';}">
          <script>
          document.execCommand("BackgroundImageCache",false,true);
          function ProcessBar(obj){
                this.isMoving = false;
                this.maxLength = parseInt(obj.parentNode.style.width.replace("px",""));
                this.nowLength = parseInt(obj.style.width.replace("px",""));
                this.moveInterval = 100;
                this.moveRange = 1;
                this.timer;
                this.obj = obj;
                ProcessBar.nowObj = this;
                this.changeMode = function(){
               this.isMoving = !this.isMoving;
           
               if(this.isMoving){
                this.timer = window.setInterval(ProcessBar.nowObj.moving, this.moveInterval);
               }else{
                window.clearInterval(this.timer);
               }
                }
                this.moving = function(){
                     ProcessBar.nowObj.nowLength += ProcessBar.nowObj.moveRange;
               ProcessBar.nowObj.obj.style.width = ProcessBar.nowObj.nowLength;
               ProcessBar.nowObj.obj.parentNode.lastChild.firstChild.data = Math.ceil((ProcessBar.nowObj.nowLength/ProcessBar.nowObj.maxLength)*100) + "%";
               if(ProcessBar.nowObj.nowLength >= ProcessBar.nowObj.maxLength){
                window.clearInterval(ProcessBar.nowObj.timer);
                ProcessBar.nowObj.obj.parentNode.lastChild.firstChild.data = "Complete!";
               }
                }
            
          }
          var processBar = new ProcessBar(proc);
          </script> 
          posted on 2007-12-04 13:47 fish的Blog 閱讀(1732) 評論(0)  編輯  收藏 所屬分類: JavaScript
          主站蜘蛛池模板: 金昌市| 南川市| 肃北| 公主岭市| 普兰店市| 东至县| 永宁县| 吴桥县| 萍乡市| 黎川县| 临沂市| 雅安市| 习水县| 吉隆县| 内江市| 茂名市| 横峰县| 呼伦贝尔市| 鹿邑县| 长宁区| 鄂温| 延安市| 封开县| 靖江市| 延长县| 宁海县| 普兰县| 太和县| 曲麻莱县| 漳浦县| 扎囊县| 屯留县| 万源市| 东乌| 闽清县| 韶山市| 罗定市| 云阳县| 临猗县| 盘锦市| 张家口市|