用法
1.将以下js文件加入到head部分
<SCRIPT src="http://www.hotajax.org/download/jquery/progress bar/Progress Bar/jquery.js"
type=text/javascript></SCRIPT>
<SCRIPT
src="http://www.hotajax.org/download/jquery/progress bar/Progress Bar/jqueryprogressbar.js"
type=text/javascript></SCRIPT>
2.创建css文件,你也可以将以下代码加入到head部分
<STYLE>#progressbar {
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;
BORDER-LEFT: black 1px solid; WIDTH: 200px;
COLOR: black; BORDER-BOTTOM: black 1px solid; POSITION: relative; HEIGHT: 20px
}
#progressbar DIV.progress {
OVERFLOW: hidden; WIDTH: 0px; POSITION: absolute; HEIGHT: 100%; BACKGROUND-COLOR: #369
}
#progressbar DIV.progress .text {
COLOR: white; POSITION: absolute; TEXT-ALIGN: center
}
#progressbar DIV.text {
WIDTH: 100%; POSITION: absolute; HEIGHT: 100%; TEXT-ALIGN: center
}
</STYLE>
3.为progress bar加上定时器
<SCRIPT type=text/javascript>
var pct=0;
var handle=0;
function update(){
$("#progressbar").reportprogress(++pct);
if(pct==100){
clearInterval(handle);
$("#run").val("start");
pct=0;
}
}
jQuery(function($){
$("#run").click(
function(){
if(this.value=="start"){
handle=setInterval("update()",100);
this.value="stop";
}else{
clearInterval(handle);
this.value="start";
}
}
);
$("#reset").click(function(){
pct=0;
$("#progressbar").reportprogress(0);
});
});
</SCRIPT>
也可将此代码放到head部分。
4.建立进度框,如本例所示
<DIV id=progressbar></DIV><INPUT id=run type=button value=start> <INPUT id=reset type=button value=reset>
预览
下载
{runhtmcode}
Set as favorite
Bookmark
Email This
Hits: 3086
Comments (0)

Write comment
| < Prev | Next > |
|---|
Newer news items:
- 11/10/2007 01:01 - NiceJForm完美提交表单(jquery插件)
- 10/10/2007 07:30 - jQuery的表单校验插件validate
- 09/10/2007 03:00 - autohelp(jquery)
- 08/10/2007 04:46 - LavaLamp菜单
- 17/09/2007 20:50 - 用jQuery进行两次确定提交
Older news items:
- 17/09/2007 08:35 - 基于jQuery的密码强度验证







