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:
Directions:
Step 1: Insert the following script in the HEAD section of your page
Select All
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:
-
xyz - An arbitrary variable name to store the bar reference and must be unique. This variable will have a few different methods (explained later) which can be used to control some of each bar's behavior. This variable IS REQUIRED if you wish to use these methods. However, if you do not plan to use the methods, then the variable assignment is not necessary, but it won't hurt to use it anyway.
-
width- Total width of the entire bar in pixels.
-
height- Total height of the entire bar in pixels.
-
backgroundColor- Background color of the bar. Use valid CSS color or HEX color code value.
-
borderWidth- The width of the border around the bar, in pixels.
-
borderColor- The color of the border around the bar. Use valid CSS color or HEX color code value.
-
blockColor- The darkest color of the individual blocks. The color will progressively become more transparent. Use valid CSS color or HEX color code value.
-
scrollSpeed- The delay, in milliseconds, between each scroll step. Use smaller values for faster scroll speeds.
-
blockCount- The total number of blocks to use.
-
actionCount - The number of times the bar is to scroll before actionString is performed.
-
actionString - The javascript function, in string form, to execute once the bar has scrolled actionCount times. Set this to an empty string to do nothing. If doing nothing, you can use any number as actionCount.
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.
Method |
Example |
Description |
var.toggleBar() |
toggle pause |
This method will toggle the pause status of the bar. If it is paused, it will un-pause it, and vice-versa. The code for the link at left is: <a href="javascript:bar2.togglePause()">toggle pause</a>
|
var.hideBar() |
Hide Bar 2 |
This method will show the bar. If it is already visible, it will do nothing. The code for the link at left is: <a href="javascript:bar2.hideBar()">Hide Bar 2</a>
|
var.showBar() |
Show Bar 2 |
This method will hide the bar. If it is already hidden, it will do nothing. The code for the link at left is: <a href="javascript:bar2.showBar()">Show Bar 2</a>
|
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>
分享到:
相关推荐
【标题解析】:“Vista风格硬盘进度条XP”指的是在Windows XP系统中,将原本的硬盘读写进度条样式替换为与Windows Vista系统相似的样式。Windows Vista在2006年发布,其用户界面相比XP有显著改进,包括更现代化、更...
xp风格进度条
BAT批处理脚本-WinXP相关批处理-12个 BAT批处理脚本-加密解密-22个 BAT批处理脚本-实用的批处理文件-70个 BAT批处理脚本-提示窗口进度条-17个 BAT批处理脚本-数值计算-23个 BAT批处理脚本-文件相关操作-92个 BAT...
FFMPEG WinXP 32位最终版本 ffmpeg-3.4.1-WinXP 32位WinXP开用~
移动WINXP安装攻略移动WINXP安装攻略移动WINXP安装攻略
winxp家庭版系统winxp_home
《WinXP超级精简版32位:小巧而强大的操作系统》 Windows XP,这款由微软公司推出的经典操作系统,自2001年发布以来,以其稳定性和兼容性赢得了广大用户的喜爱。尤其是对于那些追求简单、高效操作环境的用户,WinXP...
F2:将查询结果保存至CSV文件,以TAB为分隔. F3:打开已保存的SQL语句.TXT格式. F4:保存SQL语句为TXT格式. F5:执行SQL. 支持选中SQL查询. ...WINXP+VS2005+ODBC(Progress OpenEdge 10.1C Driver)测试通过.
《WinXP Manager v6.0:打造高效稳定的Windows XP系统》 WinXP Manager v6.0是一款专为Windows XP设计的全方位系统优化工具,旨在帮助用户提升系统的性能、安全性和个性化设置。这款软件包含了多达30多种不同的实用...
WinXP使用技巧WinXP使用技巧WinXP使用技巧WinXP使用技巧WinXP使用技巧WinXP使用技巧WinXP使用技巧WinXP使用技巧WinXP使用技巧
《WinXP壁纸切换工具:轻松实现桌面美化》 在Windows XP操作系统中,用户常常会被默认的桌面壁纸所局限,长时间面对同一张壁纸容易产生视觉疲劳。为了满足用户对个性化桌面的需求,"WinXP壁纸切换工具"应运而生。这...
联想工程师专用小工具 WinXP_7更新报错修复工具V1.81.1联想工程师专用小工具 WinXP_7更新报错修复工具V1.81.1联想工程师专用小工具 WinXP_7更新报错修复工具V1.81.1联想工程师专用小工具 WinXP_7更新报错修复工具V...
当GHOST进度条达到满格,表明系统安装即将完成,此时电脑会自动重启。 5. 重启时,再次按下DEL键进入BIOS设置,这次我们将SATA控制器模式切换回原生的AHCI模式(Advanced Host Controller Interface)。AHCI模式是...
### 彻彻底底认识WinXP服务 #### 一、引言 Windows XP 是一款非常流行的桌面操作系统,在其生命周期内受到了广泛的应用与喜爱。WinXP 的稳定性及兼容性使其成为许多企业和家庭用户的首选。然而,对于操作系统而言,...
近几年,新品牌机的硬盘出厂默认模式均为SATA模式,原版的WinXP光盘无法找到硬盘,其中一些品牌机可以通过修改BIOS设置解决问题,但是有些品牌机(比如HP)的BIOS是不提供硬盘模式更改的,由此导致用户不能安装WinXP...
本说明只针对WinXP-VHD. 在WindowsXP/Windows7/PE下运行WinXP_VHD_2011_24.exe 在系统盘根目录下会生成vboot_temp的临时文件夹 复制本文件夹下vboot\floppies\vboot-img\i386\vbootdsk.sys到C:\vboot_temp\...
### 中文版WinXP系统详解 #### 知识点一:中文版WinXP的起源与特点 中文版的WinXP,作为微软操作系统Windows XP的本地化版本,自2001年发布以来,在中国及使用中文的地区广受欢迎。与英文版相比,中文版WinXP在...
本篇文章将详细介绍如何在WinXP系统下配置PHP,...不过,需要注意的是,WinXP系统已不再受到官方支持,可能存在安全风险,建议升级到更新的操作系统,如Windows 10或使用Linux发行版,以获得更好的开发环境和安全支持。
本篇文章将详细讲解WinXP引导启动恢复文件的相关知识,以及如何利用提供的压缩包进行恢复。 一、WinXP引导启动过程详解 1. BIOS自检:计算机启动时,首先执行BIOS(基本输入输出系统)中的POST(加电自检),检查...