A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/zh-CN/docs/Web/API/HTMLProgressElement/position below:

HTMLProgressElement:position 属性 - Web API

HTMLProgressElement:position 属性

Baseline Widely available

HTMLProgressElement 接口的 position 只读属性返回 <progress> 元素的当前进度。

值

对于确定的进度条返回当前值除以最大值的结果,也就是说,它是介于 0.0 和 1.0 之间的分数。

对于不确定的进度条该值总是 -1。

示例 HTML
确定的进度条:<progress id="pBar"></progress>位置: <span>0</span>
JavaScript
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);
规范 浏览器兼容性

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4