Objet de plage d'entrée HTML DOM
Objet de plage d'entrée
L'objet Input Range représente un élément HTML <input> avec type="range".
Accéder à un objet de plage d'entrée
Vous pouvez accéder à un élément <input> avec type="range" en utilisant getElementById() :
Exemple
var x = document.getElementById("myRange");
Conseil : Vous pouvez également accéder à <input type="range"> en effectuant une recherche dans la collection d' éléments d'un formulaire.
Créer un objet de plage d'entrée
Vous pouvez créer un élément <input> avec type="range" en utilisant la méthode document.createElement() :
Exemple
var x = document.createElement("INPUT");
x.setAttribute("type", "range");
Propriétés de l'objet Plage d'entrée
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éthodes d'objet de plage d'entrée
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 |
Propriétés et événements standard
L'objet Input Range prend également en charge les propriétés et les événements standard .
Pages connexes
Tutoriel HTML : Formulaires HTML
Référence HTML : balise HTML <input>
Référence HTML : attribut de type HTML <input>