Объект ввода диапазона HTML DOM
Входной объект диапазона
Объект Input Range представляет HTML-элемент <input> с type="range".
Доступ к объекту входного диапазона
Вы можете получить доступ к элементу <input> с type="range" с помощью getElementById():
Пример
var x = document.getElementById("myRange");
Совет: Вы также можете получить доступ к <input type="range">, выполнив поиск в коллекции элементов формы.
Создайте объект входного диапазона
Вы можете создать элемент <input> с type="range" с помощью метода document.createElement():
Пример
var x = document.createElement("INPUT");
x.setAttribute("type", "range");
Свойства объекта диапазона ввода
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 |
Методы объекта диапазона ввода
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 |
Стандартные свойства и события
Объект Input Range также поддерживает стандартные свойства и события .
Связанные страницы
Учебник по HTML: HTML-формы
Справочник по HTML: HTML-тег <input>
Справочник по HTML: HTML-атрибут типа <input>