|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
FF1+ IE5+ Opr7+
WinXP Progress Bar (version 1.2) Author:
Brian
Gosselin |
Homepage
Description: A great looking pure DHTML progress bar that resembles the one seen in Window XP's startup screen. All visual aspects of the bar can be customized, and the script can be invoked multiple times to display multiple bars on the same page. Script works in both IE5+ and NS6+. Note that this script by default doesn't perform any action other than animating the progress bar. It's up to you to create helper functions to accomplish any relevant tasks. Demo: Step 1: Insert the following script in the HEAD section of your page The above script references an external .js file, which you can download below: xp_progress.js (download by right clicking, and selecting "Save As") Be sure to upload this .js file to your web server. Step 2: Within the BODY of your page where you wish the Progress Bar to appear, add the below script: <script type="text/javascript"> var bar1= createBar(300,15,'white',1,'black','blue',85,7,3,""); </script> That's it! Read on for an explanation of each parameter within function createBar(). Explanation of parameters within createBar() To customize the look of the progress bar, simply pass in different values into createBar(): var xyz = createBar(width, height, backgroundColor, borderWidth, borderColor, blockColor, scrollSpeed, blockCount, actionCount, actionString) They are:
So for example, by changing the parameter settings, you can display a different looking Progress Bar, and one that executes a function after the Progress Bar has scrolled 3 cycles: <script type="text/javascript">
var bar2= createBar(320,15,'white',1,'black','green',85,7,3,"alert('Hi there')");
</script>
(alert message disabled in actual demo). Explanation of methods() to control the progress bar Each bar, when assigned to a variable (ie: bar2) has several control methods you can call directly via javascript or in a link. These methods allow you to do things like pause the Progress Bar, hide or reveal it. Each of these is described below, along with an example which will control the bar above.
Try clicking the links in the middle column to see how it affects the green Progress Bar. Just in case you're confused how all this fits together, here's an example that scrolls a Progress Bar for 5 cycles before pausing and redirects to another page: <script type="text/javascript">
function redirectpage(){
bar3.togglePause()
window.location="http://www.javascriptkit.com"
}
var bar3= createBar(320,15,'white',1,'black','red',85,7,5,"redirectpage()");
</script>
|