The read-only position
property returns the current position of the progress bar.
The value of this property is the result of dividing the current value by the maximum value.
position |
Yes | 10.0 | Yes | Yes | Yes |
var v = progressObject.position
A floating point number representing the current position of the progress bar.
The following code shows how to get the current position of the progress bar.
<!DOCTYPE html>
<html>
<body>
<progress id="myProgress" value="25" max="100"></progress>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from ww w . j av a2 s . c o m-->
var x = document.getElementById("myProgress").position;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: