Tip: you can modify some code before running
<script language="javascript">// Timer Bar-Version 1.0 // Author: Brian Gosselin of http://scriptasylum.com // Script featured on http://www.dynamicdrive.comvar loadedcolor = 'dark'; // progress bar COLORvar unloadedcolor = 'lightgrey '; // color of unloaded AREAvar bordercolor = 'navy'; // color of the BORDERvar barheight = 15; // height of progress bar in PIXELSvar barwidth = 300; // width of the bar in PIXELSvar waitTime = 5; // NUM Ber of seconds for progressbar // the function below contains the action (S) taken once bar reaches 100%. // if no action is desired, take everything out from between the curly braces ({}) // but leave the function name and curly braces in place. // PRESENTLY, it is set to do nothing, but can be changed easily. // to cause a redirect to another page, insert the following line: // window. location = "http :// Redirect_page.html "; // just change the actual url of course :) var action = function () {alert (" 52515.net welcome! "); // Window. location = "http://www.dynamicdrive.com }//********************************* * ****************** // *********** DO NOT EDIT BEYOND THIS POINT **********////************************** * ************************* // var ns4 = (document. layers )? True: false; var ie4 = (document. all )? True: false; var blocksize = (barwidth-2)/waitTime/10; var loaded = 0; var Pbouter; var Pbdone; var PBbckgnd; var Pid = 0; var txt = ''; if (ns4) {txt + ='<table border=0 cellpadding=0 cellspacing=0><tr><td>'; Txt + ='<ilayer name="Pbouter" visibility="hide" height="'+barheight+'" width="'+barwidth+'" onmouseup="hidebar()">'; Txt + ='<layer width="'+barwidth+'" height="'+barheight+'" bgcolor="'+bordercolor+'" top="0" left="0"></layer>'; Txt + ='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+unloadedcolor+'" top="1" left="1"></layer>'; Txt + ='<layer name="Pbdone" width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+loadedcolor+'" top="1" left="1"></layer>'; Txt + ='</ilayer>'; Txt + ='</td></tr></table>';} Else {txt + ='<div id="Pbouter" onmouseup="hidebar()" +bordercolor+'; width:'+barwidth+'px; height:'+barheight+'px;">';txt+='<div +(barwidth-2)+'px; height:'+(barheight-2)+'px; background-color:'+unloadedcolor+'; font-size:1px;"></div>'; Txt + ='<div id="Pbdone" +(barheight-2)+'px; background-color:'+loadedcolor+'; font-size:1px;"></div>';txt+='</div>';}document.write(txt);function incrCount(){window.status="Loading…";loaded++;if(loaded<0)loaded=0;if(loaded>=waitTime*10){clearInterval(Pid);loaded=waitTime*10;setTimeout('hidebar()',100);}resizeEl(Pbdone, 0, blocksize*loaded, barheight-2, 0);}function hidebar(){clearInterval(Pid);window.status='';//if(ns4)Pbouter.visibility="hide";//else Pbouter.style.visibility="hidden";action();}//THIS FUNCTION BY MIKE HALL OF BRAINJAR.COMfunction findlayer(name,doc){var I,layer;for(I=0;I<doc.layers.length;I++){layer=doc.layers[I];if(layer.name==name)return layer;if(layer.document.layers.length>0)if((layer=findlayer(name,layer.document))!=null)return layer;}return null;}function progressBarInit(){Pbouter=(ns4)?findlayer('Pbouter',document):(ie4)?document.all['Pbouter']:document.getElementById('Pbouter');Pbdone=(ns4)?Pbouter.document.layers['Pbdone']:(ie4)?document.all['Pbdone']:document.getElementById('Pbdone');resizeEl(Pbdone,0,0,barheight-2,0);if(ns4)Pbouter.visibility="show";else Pbouter.style.visibility="visible";Pid=setInterval('incrCount()',95);}function resizeEl(id,t,r,b,l){if(ns4){id.clip.left=l;id.clip.top=t;id.clip.right=r;id.clip.bottom=b;}else id.style.width=r+'px';}window.onload=progressBarInit;</script>
提示:您可以先修改部分代码再运行