A RetroSearch Logo

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

Search Query:

Showing content from http://developer.mozilla.org/zh-CN/docs/Web/API/HTMLProgressElement/max below:

HTMLProgressElement:max 属性 - Web API

HTMLProgressElement:max 属性

Baseline Widely available

HTMLProgressElement 接口的 max 属性表示 <progress> 元素的范围的上限。

值

一个大于零的浮点数。默认值是 1.0。

示例 HTML
进度:<progress id="pBar"></progress> <span>0</span>%
JavaScript
const pBar = document.getElementById("pBar");
const span = document.getElementsByTagName("span")[0];

console.log(`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);
规范 浏览器兼容性

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