Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!

The HTMLLabelElement interface gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface.

Properties

Inherits properties from its parent, HTMLElement.

HTMLLabelElement.control Read only
Is a HTMLElement representing the control with which the label is associated.
HTMLLabelElement.form Read only
Is a HTMLFormElement object representing the form with which the labeled control is associated, or null if there is no associated control, or if that control isn't associated with a form. In other words, this is just a shortcut for HTMLLabelElement.control.form.
HTMLLabelElement.htmlFor
Is a string containing the ID of the labeled control. This reflects the for attribute.

Methods

No specific methods; inherits methods from its parent, HTMLElement.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'HTMLLabelElement' in that specification.
Living Standard No change from HTML5.
HTML5
The definition of 'HTMLLabelElement' in that specification.
Recommendation The property accessKey is now defined on HTMLElement.
The following property has been added: control.
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'HTMLLabelElement' in that specification.
Recommendation No change from Document Object Model (DOM) Level 1 Specification.
Document Object Model (DOM) Level 1 Specification
The definition of 'HTMLLabelElement' in that specification.
Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 1.0 (1.7 or earlier) [1] (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) 1.0 (1.0) [1] (Yes) (Yes) (Yes)

[1] The form attribute's meaning was changed in a specification revision on April 28, 2016. Previously, it returned a form with which the label was directly associated. However, labels are no longer members of forms; instead, this attribute now returns the form with which the control is affiliated.

See also

文件標籤與貢獻者

 最近更新: slimsag,