Jenis properti HTML DOM Checkbox
Definisi dan Penggunaan
Jenis properti mengembalikan jenis bentuk elemen.
Untuk objek kotak centang, properti selalu mengembalikan "kotak centang".
tatabahasa
checkboxObject.type
Dukungan Browser
Semua browser utama mendukung atribut Jenis
contoh
contoh
Contoh berikut mengembalikan tipe kotak centang bentuk elemen:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "Check1") ketik .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
<Input type = "checkbox" id = "Check1"> Anda seperti musim panas?
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> jenis input Tampilan </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "Check1") ketik .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
<Input type = "checkbox" id = "Check1"> Anda seperti musim panas?
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> jenis input Tampilan </ button>
</ Body>
</ Html>
Coba »
benda kotak centang