HTML DOM nilai Atur ulang properti
Definisi dan Penggunaan
nilai set properti atau mengembalikan nilai dari nilai properti tombol reset.
atribut nilai menentukan teks yang ditampilkan pada tombol reset.
tatabahasa
Mengatur properti nilai:
resetObject.value="value"
Mengembalikan nilai properti:
resetObject.value
Dukungan Browser
Semua browser utama mendukung nilai atribut
contoh
contoh
Contoh berikut meminta tampilan teks pada tombol reset:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "reset1") nilai .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
Email: <input type = "text" id = "email">
<Input type = "reset" id = "reset1" value = "Reset bentuk">
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> untuk menampilkan nilai dari tombol reset </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "reset1") nilai .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
Email: <input type = "text" id = "email">
<Input type = "reset" id = "reset1" value = "Reset bentuk">
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> untuk menampilkan nilai dari tombol reset </ button>
</ Body>
</ Html>
Coba »
benda ulang