HTML-DOM Radiotyp Eigenschaft
Definition und Verwendung
Typ-Eigenschaft gibt das Optionsfeld Formularelement-Typ.
Für Radio-Buttons, ist das Attribut immer "Radio".
Grammatik
radioObject.type
Browser-Unterstützung
Alle gängigen Browser unterstützen type-Attribut
Beispiele
Beispiele
Das folgende Beispiel gibt das Optionsfeld Formularelement Typ:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Titel> Dieses Tutorial (w3big.com) </ title>
<Script>
Funktion displayResult () {
var x = document.getElementById ( "rot") Typ .;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Welche Farbe bevorzugen Sie? <br>
<Input type = "radio" name = "Farben" id = "red"> red <br>
<Input type = "radio" name = "Farben" id = "blue"> Blue <br>
<Input type = "radio" name = "Farben" id = "green"> grün
</ Form>
<Taste type = "button" Onclick = "displayResult ()"> Display input type </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Titel> Dieses Tutorial (w3big.com) </ title>
<Script>
Funktion displayResult () {
var x = document.getElementById ( "rot") Typ .;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Welche Farbe bevorzugen Sie? <br>
<Input type = "radio" name = "Farben" id = "red"> red <br>
<Input type = "radio" name = "Farben" id = "blue"> Blue <br>
<Input type = "radio" name = "Farben" id = "green"> grün
</ Form>
<Taste type = "button" Onclick = "displayResult ()"> Display input type </ button>
</ Body>
</ Html>
Versuchen »
Radio - Objekte