Skip to content

Commit 7efc89c

Browse files
committed
Progress Tag
1 parent 9c6e816 commit 7efc89c

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,26 @@ value: If you don’t specify a value, the first numeric value inside the `<mete
9090

9191
**4.) progress**: indicates how much of a task has been completed (often marked as a percentage). It is expected to be modified through JavaScript code.
9292
```html
93-
<p>Now destroying the world. <br />
94-
<p>
95-
progress:
96-
<progress value = "25"
97-
max = "100"></progress>
98-
</p>
93+
94+
<p>Progress: <progress id="bar" value="0" max="100"><span>0</span>%</progress></p>
95+
96+
<script type="text/javascript">
97+
var i = 0;
98+
var progressBar = document.getElementById("bar");
99+
100+
function countNumbers() {
101+
if(i < 100) {
102+
i = i + 1;
103+
progressBar.value = i;
104+
// For browsers that don't support progress tag
105+
progressBar.getElementsByTagName("span")[0].textContent = i;
106+
}
107+
108+
// Wait for sometime before running this script again
109+
setTimeout("countNumbers()", 100);
110+
}
111+
countNumbers();
112+
</script>
99113
```
100114
#### Q. What is the DOM? How does the DOM work?
101115

0 commit comments

Comments
 (0)