HTML-DOM - Eingabebereichsobjekt
Eingabebereichsobjekt
Das Input Range-Objekt repräsentiert ein HTML-<input>-Element mit type="range".
Greifen Sie auf ein Eingabebereichsobjekt zu
Sie können auf ein <input>-Element mit type="range" zugreifen, indem Sie getElementById() verwenden:
Beispiel
var x = document.getElementById("myRange");
Tipp: Sie können auch auf <input type="range"> zugreifen, indem Sie die Elementsammlung eines Formulars durchsuchen .
Erstellen Sie ein Eingabebereichsobjekt
Sie können ein <input>-Element mit type="range" erstellen, indem Sie die Methode document.createElement() verwenden:
Beispiel
var x = document.createElement("INPUT");
x.setAttribute("type", "range");
Objekteigenschaften des Eingabebereichs
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a slider control |
autofocus | Sets or returns whether a slider control should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a slider control |
disabled | Sets or returns whether a slider control is disabled, or not |
form | Returns a reference to the form that contains the slider control |
list | Returns a reference to the datalist that contains the slider control |
max | Sets or returns the value of the max attribute of the slider control |
min | Sets or returns the value of the min attribute of the slider control |
name | Sets or returns the value of the name attribute of a slider control |
step | Sets or returns the value of the step attribute of the slider control |
type | Returns which type of form element the slider control is |
value | Sets or returns the value of the value attribute of a slider control |
Objektmethoden für den Eingabebereich
Method | Description |
---|---|
stepDown() | Decrements the value of the slider control by a specified number |
stepUp() | Increments the value of the slider control by a specified number |
Standardeigenschaften und -ereignisse
Das Input Range-Objekt unterstützt auch die Standardeigenschaften und -ereignisse .
Verwandte Seiten
HTML-Tutorial: HTML-Formulare
HTML-Referenz: HTML-<input>-Tag
HTML-Referenz: HTML-Attribut vom Typ <input>