Oggetto pulsante di input HTML DOM
Oggetto pulsante di input
L'oggetto Input Button rappresenta un elemento HTML <input> con type="button".
Accedi a un oggetto pulsante di input
Puoi accedere a un elemento <input> con type="button" usando getElementById():
Esempio
var x = document.getElementById("myBtn");
Suggerimento: puoi anche accedere a <input type="button"> cercando nella raccolta di elementi di un modulo.
Crea un oggetto pulsante di input
Puoi creare un elemento <input> con type="button" usando il metodo document.createElement():
Esempio
var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Proprietà dell'oggetto pulsante di input
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 |
Proprietà ed eventi standard
L'oggetto Pulsante di input supporta anche le proprietà e gli eventi standard .
Pagine correlate
Esercitazione HTML: Moduli HTML
Riferimento HTML: tag HTML <input>
Riferimento HTML: attributo tipo HTML <input>