Objekt vstupního tlačítka HTML DOM
Objekt tlačítka vstupu
Objekt Input Button představuje HTML element <input> s type="button".
Přístup k objektu vstupního tlačítka
K prvku <input> můžete přistupovat s type="button" pomocí getElementById():
Příklad
var x = document.getElementById("myBtn");
Tip: K <input type="button"> se dostanete také prohledáváním kolekce prvků formuláře.
Vytvořte objekt vstupního tlačítka
Element <input> můžete vytvořit s type="button" pomocí metody document.createElement():
Příklad
var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Vlastnosti objektu vstupního tlačítka
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 |
Standardní vlastnosti a události
Objekt Input Button také podporuje standardní vlastnosti a události .
Související stránky
HTML výukový program: HTML formuláře
HTML reference: HTML tag <input>
HTML reference: HTML <input> typ atributu