HTML DOM properti Sandi MAXLENGTH
Definisi dan Penggunaan
maxlength set properti atau mengembalikan jumlah karakter maksimum yang diizinkan di bidang sandi.
tatabahasa
Pengaturan properti MAXLENGTH:
passwordObject.maxLength=integer
Kembali MAXLENGTH atribut:
passwordObject.maxLength
Dukungan Browser
Semua browser utama mendukung properti MAXLENGTH
contoh
contoh
Contoh berikut menunjukkan jumlah karakter maksimum yang diizinkan dalam domain sandi tertentu:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "pwd") MAXLENGTH .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
Password: <input type = "password" id = "pwd" maxlength = "8">
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> untuk display memungkinkan jumlah maksimum karakter yang dimasukkan. </ Tombol>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
Fungsi displayResult () {
var x = document.getElementById ( "pwd") MAXLENGTH .;
alert (x);
}
</ Script>
</ Kepala>
<Body>
<Form>
Password: <input type = "password" id = "pwd" maxlength = "8">
</ Form>
<Tombol type = "button" onclick = "displayResult ()"> untuk display memungkinkan jumlah maksimum karakter yang dimasukkan. </ Tombol>
</ Body>
</ Html>
Coba »
Kata benda