The HTMLOutputElement
interface provides properties and methods (beyond those inherited from HTMLElement
) for manipulating the layout and presentation of <output>
elements.
プロパティ
名称 | 型 | 説明 |
---|---|---|
defaultValue |
DOMString |
The default value of the element, initially the empty string. |
form 読取専用 |
HTMLFormElement |
Indicates the control's form owner, reflecting the form HTML attribute if it is defined. |
htmlFor 読取専用 |
DOMSettableTokenList |
Reflects the for HTML attribute, containing a list of IDs of other elements in the same document that contribute to (or otherwise affect) the calculated value . |
labels 読取専用 未実装 (参照 バグ 556743) |
NodeList |
A list of label elements associated with this output element. |
name |
DOMString |
Reflects the name HTML attribute, containing the name for the control that is submitted with form data. |
type |
DOMString |
Must be the string output . |
validationMessage |
DOMString |
A localized message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate for constraint validation (willValidate is false ), or it satisfies its constraints. |
validity 読取専用 |
ValidityState |
The validity states that this element is in. |
value |
DOMString |
The value of the contents of the elements. Behaves like the Node.textContent property. |
willValidate 読取専用 |
Boolean |
in Gecko 2.0. Indicates whether the element is a candidate for constraint validation. It is false if any conditions bar it from constraint validation. (See バグ 604673.) The standard behavior is to always return false because output objects are never candidates for constraint validation. |
メソッド
名称および引数 | 戻り値 | 説明 |
---|---|---|
checkValidity() |
Boolean |
in Gecko 2.0. Returns false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires an invalid event at the element. It returns true if the element is not a candidate for constraint validation, or if it satisfies its constraints.The standard behavior is to always return true because output objects are never candidates for constraint validation. |
setCustomValidity (in DOMString error) |
void |
Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity error, and does not validate. |
Modes
This element behaves in one of two modes: default mode and value mode.
Default Mode
Initially, the element is in default mode, and so the contents of the element represent both the value of the element and its default value.
If the element is in default mode when the descendants of the element are changed in any way, the defaultValue
property is set to the value of the textContent
property.
Resetting the form puts the element into default mode, and sets the textContent
property to the value of the defaultValue
property.
Value Mode
The element goes into value mode when the contents of the value
property are set. The value
property otherwise behaves like the textContent
property. When the element is in value mode, the default value is accessible only through the defaultValue
property.