Object HTML DOM -invoerknop
Invoerknopobject
Het Input Button-object vertegenwoordigt een HTML <input>-element met type="button".
Toegang tot een invoerknopobject
U kunt een <input>-element openen met type="button" door getElementById() te gebruiken:
Voorbeeld
var x = document.getElementById("myBtn");
Tip: U kunt ook toegang krijgen tot <input type="button"> door te zoeken in de elementenverzameling van een formulier.
Een invoerknopobject maken
U kunt een <input>-element maken met type="button" met behulp van de document.createElement()-methode:
Voorbeeld
var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Eigenschappen van invoerknopobject
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 |
Standaard eigenschappen en evenementen
Het Input Button-object ondersteunt ook de standaardeigenschappen en events .
Gerelateerde pagina's
HTML-zelfstudie: HTML-formulieren
HTML-referentie: HTML <input>-tag
HTML-referentie: HTML <input> type attribuut