Latest web development tutorials

HTML DOM Checkbox diperiksa properti

Checkbox Referensi Obyek benda kotak centang

Definisi dan Penggunaan

diperiksa set properti atau kembali apakah kotak centang harus diperiksa.

tatabahasa

Pengaturan properti diperiksa:

checkboxObject.checked=true|false

Pengembalian memeriksa atribut:

checkboxObject.checked


Dukungan Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Semua browser utama mendukung properti diperiksa


contoh

contoh

Contoh berikut menetapkan status kotak centang:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi cek () {
document.getElementById ( "Check1"). diperiksa = true
}
Fungsi hapus centang () {
document.getElementById ( "Check1"). diperiksa = false
}
</ Script>
</ Kepala>
<Body>

<Form>
<Input type = "checkbox" id = "Check1"> Anda seperti musim panas?
</ Form>
<Tombol onclick = "cek ()"> untuk mengkonfirmasi kotak pilihan </ button>
<Tombol onclick = "hapus centang ()"> tidak mengkonfirmasi kotak pilihan </ button>

</ Body>
</ Html>

Coba »


contoh s

contoh yang lebih

Checkbox - teks dikonversi ke huruf besar

Sebuah bentuk beberapa kotak centang


Checkbox Referensi Obyek benda kotak centang