HTML DOM Sandi properti defaultValue
Definisi dan Penggunaan
defaultValue set properti atau mengembalikan nilai default dari bidang sandi.
Catatan: Nilai default adalah nilai default yang ditentukan dalam HTML "nilai" atribut.
tatabahasa
Pengaturan properti defaultValue:
passwordObject.defaultValue="value"
Kembali defaultValue atribut:
passwordObject.defaultValue
Dukungan Browser
Semua browser utama mendukung properti defaultValue
contoh
contoh
Contoh berikut tersedia field kata sandi default:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "pwd") defaultValue .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
Password: <input type = "password" id = "pwd" value = "thgrt456">
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> menampilkan nilai default </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "pwd") defaultValue .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
Password: <input type = "password" id = "pwd" value = "thgrt456">
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> menampilkan nilai default </ button>
</ Body>
</ Html>
Coba »
Kata benda