HTMLProgressElement: max-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Die max
-Eigenschaft der HTMLProgressElement
-Schnittstelle stellt die obere Grenze des Bereichs des <progress>
-Elements dar.
Wert
Eine Fließkommazahl, die größer als null ist. Der Standardwert ist 1,0.
Beispiele
HTML
html
Progress: <progress id="pBar"></progress> <span>0</span>%
JavaScript
js
const pBar = document.getElementById("pBar");
const span = document.getElementsByTagName("span")[0];
console.log(`Default value of max: ${pBar.max}`);
pBar.max = 100;
pBar.value = 0;
setInterval(() => {
pBar.value = pBar.value < pBar.max ? pBar.value + 1 : 0;
span.textContent = Math.trunc(pBar.position * 100);
}, 100);
Spezifikationen
Specification |
---|
HTML # dom-progress-max |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
max |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.