HTML-DOM -Input-Radio -Objekt
Funkobjekt eingeben
Das Input Radio-Objekt repräsentiert ein HTML-<input>-Element mit type="radio".
Greifen Sie auf ein Input-Radio-Objekt zu
Sie können auf ein <input>-Element mit type="radio" zugreifen, indem Sie getElementById() verwenden:
Beispiel
var x = document.getElementById("myRadio");
Tipp: Sie können auch auf <input type="radio"> zugreifen, indem Sie die Elementsammlung eines Formulars durchsuchen .
Erstellen Sie ein Input-Radio-Objekt
Sie können ein <input>-Element mit type="radio" erstellen, indem Sie die Methode document.createElement() verwenden:
Beispiel
var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
Eigenschaften des Funkobjekts eingeben
Property | Description |
---|---|
autofocus | Sets or returns whether a radio button should automatically get focus when the page loads |
checked | Sets or returns the checked state of a radio button |
defaultChecked | Returns the default value of the checked attribute |
defaultValue | Sets or returns the default value of a radio button |
disabled | Sets or returns whether the radio button is disabled, or not |
form | Returns a reference to the form that contains the radio button |
name | Sets or returns the value of the name attribute of a radio button |
required | Sets or returns whether the radio button must be checked before submitting a form |
type | Returns which type of form element the radio button is |
value | Sets or returns the value of the value attribute of the radio button |
Standardeigenschaften und -ereignisse
Das Input Radio - Objekt unterstützt auch die Standardeigenschaften und - ereignisse .
Verwandte Seiten
HTML-Tutorial: HTML-Formulare
HTML-Referenz: HTML-<input>-Tag
HTML-Referenz: HTML-Attribut vom Typ <input>