1.html(div做的进度条)怎么样才能直接在进度条上点击就能改变值
用jquery 来实现很简单,div 的“进度”就是本身百分比长度,对吧,
var w_width = $('.progress-wrp').width();//拿到容器宽度,即为进度条总长度
$('.progress').click(function(){ //点击进度条
var width = $(this).width(), //获得自身宽度
per = Math.round(width/w_width*100); //得到百分比
console.log(per);//打印到控制台
});想要得到进度必须借助js,而jquery是比较省事的做法。
其实你可以在进度条改变的时候,定义一个变量实时取值,点击时候直接输出,这样就不用点击后在求值了。
2.html5 css3 怎么制作简单的进度条
HTML代码:
CSS代码:.progress { height: 20px; background: #ebebeb; border-left: 1px solid transparent; border-right: 1px solid transparent; border-radius: 10px;}.progress > span { position: relative; float: left; margin: 0 -1px; min-width: 30px; height: 18px; line-height: 16px; text-align: right; background: #cccccc; border: 1px solid; border-color: #bfbfbf #b3b3b3 #9e9e9e; border-radius: 10px; background-image: -webkit-linear-gradient(top, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); background-image: -moz-linear-gradient(top, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); background-image: -o-linear-gradient(top, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); background-image: linear-gradient(to bottom, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);}.progress > span > span { padding: 0 8px; font-size: 11px; font-weight: bold; color: #404040; color: rgba(0, 0, 0, 0.7); text-shadow: 0 1px rgba(255, 255, 255, 0.4);}.progress > span:before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 1; height: 18px; background: url("../img/progress.png") 0 0 repeat-x; border-radius: 10px;}.progress .green { background: #85c440; border-color: #78b337 #6ba031 #568128; background-image: -webkit-linear-gradient(top, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); background-image: -moz-linear-gradient(top, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); background-image: -o-linear-gradient(top, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); background-image: linear-gradient(to bottom, #b7dc8e 0%, #99ce5f 70%, #85c440 100%);}.progress .red { background: #db3a27; border-color: #c73321 #b12d1e #8e2418; background-image: -webkit-linear-gradient(top, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); background-image: -moz-linear-gradient(top, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); background-image: -o-linear-gradient(top, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); background-image: linear-gradient(to bottom, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%);}.progress .orange { background: #f2b63c; border-color: #f0ad24 #eba310 #c5880d; background-image: -webkit-linear-gradient(top, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); background-image: -moz-linear-gradient(top, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); background-image: -o-linear-gradient(top, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); background-image: linear-gradient(to bottom, #f8da9c 0%, #f5c462 70%, #f2b63c 100%);}.progress .blue { background: #5aaadb; border-color: #459fd6 #3094d2 #277db2; background-image: -webkit-linear-gradient(top, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); background-image: -moz-linear-gradient(top, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); background-image: -o-linear-gradient(top, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); background-image: linear-gradient(to bottom, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%);}。
3.网页进度条怎么做
给你一段参考代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT>
var i;
function longtime()
{
i=0;
b1.style.cursor="wait";
b1.disabled=true;
timedIterations();
}
function timedIterations()
{
if (i<=140)
{
d1.innerText="正在装载。。。"+Math.round(i/1.4)+"%";
d2.style.width=i;
// following statements represents a calculation that takes some time
var j=0;
while (j<=10000)
j++;
setTimeout("timedIterations();", 1);
i++;
}
else
{
b1.style.cursor="";
b1.disabled=false;
}
}
</SCRIPT>
</HEAD>
<BODY id=b1 onl oad="longtime();" leftmargin=250 topmargin=200>
<DIV id="d1">;正在装载。..</DIV>
<DIV id="d2" style="background-color:#1b3679"></DIV>
</BODY>
</HTML>
4.用javascript写的进度条,怎么获取进度条的值,按百分比显示出来
s[0].style.width = 100 - r / i * 100 + "%";该代码不就是设置进度条的么
如果你能更改页面 你在标签中这样写:
(资料完整度
)然后在你的js中
s[0].style.width = 100 - r / i * 100 + "%";的下面 写上:
document.getelementbyid("wz_jd").innerhtml = 100 - r / i * 100 + "%";不就ok了么
注意:你的js中哪儿有那行代码 就在那行下面 追加
如果不能更改页面就在那行代码下面 这样写:
document.getelementsbytagname("h5")[0].innerhtml = "(资料完整度"+ (100 - r / i * 100) + "%)";里面的0 表示是第1个h5标签 如果你有多个 自己进行更改
5.这个html网页跳转带有进度条的跳转代码怎么做
可以用html5实现,也可以做成gif的图片,你只需要设置为和你程序设置一样的时间然后进度条自动结束就好了。
用图片是最好实现,用ps软件就可以制作。这个的实现,有很多中方法,简单的,是使用 DIV 嵌套,例如:100px 代表 100 分, 64px 代表实际的得分该进度条是100毫秒,+ 1% ,10秒钟后,跳转页面!要改时间的话!改100就好了。
转载请注明出处育才学习网 » html进度条怎么写