HTMLProgressElement: position-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 position-Eigenschaft des HTMLProgressElement-Interfaces, die nur lesen ist, gibt den aktuellen Fortschritt des <progress>-Elements zurück.

Wert

Für eine determinierte Fortschrittsanzeige gibt sie das Ergebnis des aktuellen Wertes geteilt durch den Maximalwert zurück, d.h. ein Bruchteil zwischen 0.0 und 1.0.

Für eine indeterminierte Fortschrittsanzeige beträgt der Wert immer -1.

Beispiele

HTML

html
Determinate Progress bar: <progress id="pBar"></progress> Position:
<span>0</span>

JavaScript

js
const pBar = document.getElementById("pBar");
const span = document.getElementsByTagName("span")[0];

pBar.max = 100;
pBar.value = 0;

setInterval(() => {
  pBar.value = pBar.value < pBar.max ? pBar.value + 1 : 0;

  span.textContent = pBar.position;
}, 100);

Spezifikationen

Specification
HTML
# dom-progress-position-dev

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
position

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support