bentuk sifat HTML DOM Checkbox
Definisi dan Penggunaan
bentuk properti mengembalikan referensi ke bentuk yang berisi kotak centang.
Properti ini mengembalikan objek bentuk.
tatabahasa
checkboxObject.form
Dukungan Browser
Semua browser utama mendukung sifat bentuk
contoh
contoh
Contoh pesawat kembali bentuk kotak centang milik id:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "myCheck") form.id .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form id = "form1">
<Input type = "checkbox" = id "myCheck"> Anda seperti musim panas?
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> pilih kotak akan menampilkan bentuk ID </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "myCheck") form.id .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form id = "form1">
<Input type = "checkbox" = id "myCheck"> Anda seperti musim panas?
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> pilih kotak akan menampilkan bentuk ID </ button>
</ Body>
</ Html>
Coba »
benda kotak centang