HTML DOM Masukan Tombol jenis atribut
Definisi dan Penggunaan
Jenis properti mengembalikan jenis elemen form.
Jenis tombol objek selalu "tombol".
tatabahasa
buttonObject.type
Dukungan Browser
Semua browser utama mendukung atribut Jenis
contoh
contoh
Contoh berikut akan kembali ke tombol bentuk jenis elemen:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "button1") ketik .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
<Input type = "button" onclick = "displayResult ()" value = "display jenis tombol" id = "button1">
</ Form>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "button1") ketik .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
<Input type = "button" onclick = "displayResult ()" value = "display jenis tombol" id = "button1">
</ Form>
</ Body>
</ Html>
Coba »
tombol Objects