bentuk sifat HTML DOM Radio
Definisi dan Penggunaan
membentuk kembali properti untuk formulir yang berisi tombol referensi.
Jika berhasil, properti mengembalikan sebuah objek bentuk.
tatabahasa
radioObject.form
Dukungan Browser
Semua browser utama mendukung sifat bentuk
contoh
contoh
mengikuti contoh akan kembali tombol radio milik form id:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "red") form.id .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form id = "form1">
warna yang Anda sukai? Situs
<Input type = "radio" name = "warna" id = "red"> red Situs
<Input type = "radio" name = "warna" id = "blue"> Biru Situs
<Input type = "radio" name = "warna" id = "green"> green
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> display form id milik </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "red") form.id .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form id = "form1">
warna yang Anda sukai? Situs
<Input type = "radio" name = "warna" id = "red"> red Situs
<Input type = "radio" name = "warna" id = "blue"> Biru Situs
<Input type = "radio" name = "warna" id = "green"> green
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> display form id milik </ button>
</ Body>
</ Html>
Coba »
Objek radio