Obiekt zakresu wejściowego HTML DOM
Obiekt zakresu wejściowego
Obiekt Input Range reprezentuje element HTML <input> z type="range".
Uzyskaj dostęp do obiektu zakresu wejściowego
Możesz uzyskać dostęp do elementu <input> z type="range" za pomocą getElementById():
Przykład
var x = document.getElementById("myRange");
Wskazówka: możesz również uzyskać dostęp do <input type="range">, przeszukując kolekcję elementów formularza.
Utwórz obiekt zakresu wejściowego
Możesz utworzyć element <input> z type="range" za pomocą metody document.createElement():
Przykład
var x = document.createElement("INPUT");
x.setAttribute("type", "range");
Właściwości obiektu zakresu wejściowego
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 |
Metody obiektów zakresu wejściowego
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 |
Standardowe właściwości i zdarzenia
Obiekt Input Range obsługuje również standardowe właściwości i zdarzenia .
Powiązane strony
Samouczek HTML: formularze HTML
Odniesienie HTML: tag HTML <input>
Odniesienie HTML: atrybut typu HTML <input>