HTML DOM properti nilai Tombol Masukan
Definisi dan Penggunaan
nilai set properti atau mengembalikan nilai properti dari nilai elemen tombol.
atribut nilai menentukan teks yang ditampilkan pada tombol.
tatabahasa
Mengatur properti nilai:
buttonObject.value="value"
Mengembalikan nilai properti:
buttonObject.value
Dukungan Browser
Semua browser utama mendukung nilai atribut
contoh
contoh
: Tombol Teks Tampilan
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "button1") nilai .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
<Input type = "button" onclick = "displayResult ()" id = "button1" value = "display teks tombol">
</ Form>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "button1") nilai .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
<Input type = "button" onclick = "displayResult ()" id = "button1" value = "display teks tombol">
</ Form>
</ Body>
</ Html>
Coba »
tombol Objects