-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path054进度条.html
58 lines (54 loc) · 1.05 KB
/
054进度条.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>进度条 </title>
</head>
<style>
#progress{
position: relative;
margin: auto;
top: 200px;
display: block;
width: 200px;
height: 20px;
border-style: dotted;
border-width: thin;
border-color: darkgreen;
}
#filldiv{
position:absolute;
top: 0px;
left: 0px;
width: 0px;
height: 20px;
background: blue;
}
#percent{
position: absolute;
top: 0;
left: 200px;
}
</style>
<script src="js/common.js"></script>
<script>
var _width = 0;
var t = setInterval(function(){
var div = window.document.getElementById("filldiv");
var span = document.getElementById("percent");
//log(_width);
div.style.width = _width+"px";
span.innerHTML = parseInt(_width/200 * 100) +"%";
if(_width == 200){
clearInterval(t);
}
_width += 2;
},50);
</script>
<body>
<div id="progress">
<div id="filldiv"></div>
<span id="percent">0</span>
</div>
</body>
</html>