Objeto de rango de entrada HTML DOM
Objeto de rango de entrada
El objeto Input Range representa un elemento HTML <input> con type="range".
Acceder a un objeto de rango de entrada
Puede acceder a un elemento <input> con type="range" usando getElementById():
Ejemplo
var x = document.getElementById("myRange");
Sugerencia: también puede acceder a <input type="range"> buscando en la colección de elementos de un formulario.
Crear un objeto de rango de entrada
Puede crear un elemento <input> con type="range" usando el método document.createElement():
Ejemplo
var x = document.createElement("INPUT");
x.setAttribute("type", "range");
Propiedades del objeto de rango de entrada
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 |
Métodos de objeto de rango de entrada
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 |
Propiedades y eventos estándar
El objeto Input Range también es compatible con las propiedades y los eventos estándar .
páginas relacionadas
Tutorial de HTML: formularios HTML
Referencia HTML: etiqueta HTML <input>
Referencia HTML: atributo de tipo HTML <entrada>