博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jquery 进度条
阅读量:4512 次
发布时间:2019-06-08

本文共 1399 字,大约阅读时间需要 4 分钟。

果图

 
 
 
 
 
 
 
[html] 
<p><html> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>bar</title> 
<script type="text/javascript" src="jquery-1.8.0.min.js" ></script> 
<style type="text/css"> 
#time_back{width:300px;height:20px;border:1px solid #246;background:#CCC} 
#time_bar{width:0;height:20px;background:#470;color:#FFF;text-align:right;} 
#target_back{width:300px;height:20px;border:1px solid #246;background:#CCC} 
#target_bar{width:0;height:20px;background:#470;color:#FFF;text-align:right;} 
</style> 
<script type="text/javascript"> 
$(document).ready(function(){</p><p>  
 $("#input_time").change(function(){ 
  var rate = $(this).attr("value"); 
  changebar("#time_bar",rate,"red"); 
 }); 
  
 $("#input_target").change(function(){ 
  var rate = $(this).attr("value"); 
  changebar("#target_bar",rate,"orange"); 
 }); 
  
 /** 
 * 更新进度条 
 * @ param obj 进度条id 
 * @ param rate 进度,0-100间的整数 
 * @ param deadColor 当进度超过一定值(默认80)的颜色 
 */ 
 function changebar(obj,rate,deadColor){ 
  if(undefined!=deadColor&&rate>80){ 
   $(obj).css({"background":deadColor}) 
  } 
  rate = rate%100 + "%"; 
  $(obj).animate({width:rate},1000); 
  $(obj).html(rate); 
 } 
}); 
</script> 
<body> 
日期:<div id="time_back" ><div id="time_bar" ></div></div> 
进度:<div id="target_back" ><div id="target_bar" ></div></div> 
<input type="text" id="input_time" /> 
<input type="text" id="input_target" /> 
</body> 
</html></p> 

转载于:https://www.cnblogs.com/qingzhouyi/p/3140693.html

你可能感兴趣的文章
error MSB8008: 指定的平台工具集(v120)未安装或无效 解决办法
查看>>
5.2 面向对象上
查看>>
JSP 总结
查看>>
Host is not allowed to connect to this MySQL server 解决方案
查看>>
JS 数据类型分析及字符串的方法
查看>>
ASP.Net Core 2.2 MVC入门到基本使用系列 (一)
查看>>
ORA-00907: 缺失右括号
查看>>
【原】移动web资源整理
查看>>
第 7 章 —— 代理模式
查看>>
项目介绍&人员介绍
查看>>
服务稳定、高可用
查看>>
第2课第4节_Java面向对象编程_多态性_P【学习笔记】
查看>>
H5横向三栏布局
查看>>
7.分类:基本概念 忌讳
查看>>
PIL Image 转成 wx.Image、wx.Bitmap
查看>>
名词解释
查看>>
确保某值在区间内
查看>>
递归in C++
查看>>
整合wordpress的插件!!
查看>>
A - LCM Challenge
查看>>