-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogressbar2.htm
More file actions
49 lines (49 loc) · 833 Bytes
/
progressbar2.htm
File metadata and controls
49 lines (49 loc) · 833 Bytes
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
<! DOCTYPE html>
<html>
<head>
<style>
#myProgress{
width:100%;
background-color: #AEB6BF;
}
#myBar{
width:10%;
background-color: #1D8348 ;
height:30px;
text-align: center;
color: white;
}
button{
width:100px;
height:30px;
border-radius: 20px;
border:4px solid red;
background-color: #F1948A ;
}
</style>
</head>
<body>
<div id="myProgress">
<div id="myBar">10%</div>
</div>
<br>
<button onclick="move()">CLICK THIS</button>
<script>
function move(){
var bar=document.getElementById("myBar");
var width=1;
var id=setInterval(frame,10);
function frame()
{
if(width>=100)
{clearInterval(id);}
else {
width++;
bar.style.width=width+'%';
bar.innerHTML=width*1+'%';
}
}
}
</script>
</body>
</html>