Objet bouton d'entrée HTML DOM
Objet bouton d'entrée
L'objet Input Button représente un élément HTML <input> avec type="button".
Accéder à un objet bouton d'entrée
Vous pouvez accéder à un élément <input> avec type="button" en utilisant getElementById() :
Exemple
var x = document.getElementById("myBtn");
Conseil : Vous pouvez également accéder à <input type="button"> en recherchant dans la collection d' éléments d'un formulaire.
Créer un objet bouton d'entrée
Vous pouvez créer un élément <input> avec type="button" en utilisant la méthode document.createElement() :
Exemple
var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Propriétés de l'objet Bouton d'entrée
Property | Description |
---|---|
autofocus | Sets or returns whether an input button should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of an input button |
disabled | Sets or returns whether an input button is disabled, or not |
form | Returns a reference to the form that contains the input button |
name | Sets or returns the value of the name attribute of an input button |
type | Returns which type of form element the input button is |
value | Sets or returns the value of the value attribute of an input button |
Propriétés et événements standard
L'objet Input Button 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>