-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (65 loc) · 1.4 KB
/
index.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
59
60
61
62
63
64
65
66
67
<html>
<head>
<style type="text/css">
#meter {
border:1px solid #000;
width:55em;
margin:auto;
height: 35px;
}
#progressBar {
background:#333;
height:35px;
width:0%
}
input#count {
border: 1px solid #000;
height: 25px;
width: 300px;
margin-right: 10px;
padding:2px 5px;
}
h1 {
margin: auto;
display: table;
margin-bottom: 40px;
}
input[type="submit"] {
border: 1px solid #c1c1c1;
padding: 6px 35px;
border-radius: 5px;
}
.progressField {
margin: auto;
display: table;
}
label{
margin-right: 20px;
}
</style>
</head>
<body>
<h1>Progress Bar</h1>
<div id="meter"><div id="progressBar"></div></div>
<br>
<div class="progressField">
<input type="text" id="count" class="count" name="count" placeholder="Enter your Percentage Level"/> <label> / 100</label>
<input type="submit" onClick="progressPer()"></div>
<script>
var count = 0;
var bar = document.getElementById('progressBar');
function progressPer() {
var count = document.getElementById('count').value;
var isnum = /^\d+$/;
if(count.match(isnum)){
if(count >100)
count=100;
bar.style.width = count + "%";
}
else{
alert("only Numbers");
}
}
</script>
</body>
</html>