The max
property sets or gets the value of the max attribute of a progress bar.
max |
Yes | 10.0 | Yes | Yes | Yes |
Return the max property.
var v = progressObject.max
Set the max property.
progressObject.max=number
Value | Description |
---|---|
number | Set how much work the task requires in total |
A floating point number representing how much work the task requires in total.
The following code shows how to Get the maximum value of a 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() {<!-- w w w . j a v a 2 s . c om-->
var x = document.getElementById("myProgress").max;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to change the maximum value in a progress bar.
<!DOCTYPE html>
<html>
<body>
<progress id="myProgress" value="25" max="100"></progress>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!-- w w w .jav a2 s . com-->
document.getElementById("myProgress").max = "50";
}
</script>
</body>
</html>
The code above is rendered as follows: