-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zh-cn]: create docs for HTMLMeterElement (#23047)
Co-authored-by: A1lo <[email protected]>
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: HTMLMeterElement | ||
slug: Web/API/HTMLMeterElement | ||
l10n: | ||
sourceCommit: ec8d5627e822d866f350d9d8c06f0df58948015e | ||
--- | ||
|
||
{{APIRef("HTML DOM")}} | ||
|
||
HTML {{HTMLElement("meter")}} 元素暴露 **`HTMLMeterElement`** 接口,其提供用于操作 {{HTMLElement("meter")}} 元素的布局和展现的特定属性和方法(除了 {{domxref("HTMLElement")}} 对象接口之外,它还可以通过继承来使用)。 | ||
|
||
{{InheritanceDiagram}} | ||
|
||
## 实例属性 | ||
|
||
_还继承其父接口 {{domxref("HTMLElement")}} 的属性。_ | ||
|
||
- {{domxref("HTMLMeterElement.high")}} | ||
- : 一个 `double` 表示高档部分的数值下限,反映 [`high`](/zh-CN/docs/Web/HTML/Element/meter#high) 属性。 | ||
- {{domxref("HTMLMeterElement.low")}} | ||
- : 一个 `double` 表示低档部分的数值上限,反映 [`low`](/zh-CN/docs/Web/HTML/Element/meter#low) 属性。 | ||
- {{domxref("HTMLMeterElement.max")}} | ||
- : 一个 `double` 表示测量范围的上限,反映 [`max`](/zh-CN/docs/Web/HTML/Element/meter#max) 属性。 | ||
- {{domxref("HTMLMeterElement.min")}} | ||
- : 一个 `double` 表示测量范围的下限,反映 [`min`](/zh-CN/docs/Web/HTML/Element/meter#min) 属性。 | ||
- {{domxref("HTMLMeterElement.optimum")}} | ||
- : 一个 `double` 表示最佳数值,反映 [`optimum`](/zh-CN/docs/Web/HTML/Element/meter#optimum) 属性。 | ||
- {{domxref("HTMLMeterElement.value")}} | ||
- : 一个 `double` 表示当前数值,反映 [`value`](/zh-CN/docs/Web/HTML/Element/meter#value) 属性。 | ||
- {{domxref("HTMLMeterElement.labels")}} {{ReadOnlyInline}} | ||
- : 与此元素关联的 {{HTMLElement("label")}} 元素的 {{domxref("NodeList")}}。 | ||
|
||
## 实例方法 | ||
|
||
_此接口无具体方法,但继承了其父接口 {{domxref("HTMLElement")}} 的方法。_ | ||
|
||
## 规范 | ||
|
||
{{Specifications}} | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} | ||
|
||
## 参见 | ||
|
||
- 实现此接口的 HTML 元素:{{HTMLElement("meter")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: HTMLMeterElement:labels 属性 | ||
slug: Web/API/HTMLMeterElement/labels | ||
l10n: | ||
sourceCommit: 595cba0e07c70eda7f08a12890e00ea0281933d3 | ||
--- | ||
|
||
{{APIRef("DOM")}} | ||
|
||
**`HTMLMeterElement.labels`** 只读属性返回与 {{HTMLElement("meter")}} 元素有关联的 {{HTMLElement("label")}} 元素的 {{domxref("NodeList")}}。 | ||
|
||
## 值 | ||
|
||
一个 {{domxref("NodeList")}},包含与 `<meter>` 元素关联的 `<label>` 元素。 | ||
|
||
## 示例 | ||
|
||
### HTML | ||
|
||
```html | ||
<label id="label1" for="test">标签 1</label> | ||
<meter id="test" min="0" max="100" value="70">70</meter> | ||
<label id="label2" for="test">标签 2</label> | ||
``` | ||
|
||
### JavaScript | ||
|
||
```js | ||
window.addEventListener("DOMContentLoaded", () => { | ||
const meter = document.getElementById("test"); | ||
for (const label of meter.labels) { | ||
console.log(label.textContent); // “标签 1”和“标签 2” | ||
} | ||
}); | ||
``` | ||
|
||
{{EmbedLiveSample("示例", "100%", 30)}} | ||
|
||
## 规范 | ||
|
||
{{Specifications}} | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} |