Objek Input Password DOM HTML
- 上一页 <input> number
- 下一页 <input> radio
Objek Input Password
Objek Input Password menunjukkan elemen HTML <input> dengan type="password".
Mengakses Objek Input Password
Anda boleh guna getElementById() untuk mengakses elemen <input> dengan type="password":
var x = document.getElementById("myPsw");
Peringatan:Anda juga boleh mencari dalam borang: Kumpulan elements Untuk mengakses <input type="password">.
Mencipta Objek Input Password
Anda boleh guna kaedah document.createElement() untuk mencipta elemen <input> dengan type="password":
var x = document.createElement("INPUT"); x.setAttribute("type", "password");
Input Password 对象属性
属性 | 描述 |
---|---|
autocomplete | 设置或返回密码字段的 autocomplete 属性值。 |
autofocus | 设置或返回页面加载时密码字段是否应自动获得焦点。 |
defaultValue | 设置或返回密码字段的默认值。 |
disabled | 设置或返回是否禁用密码字段。 |
form | 返回对包含密码字段的表单的引用。 |
maxLength | 设置或返回密码字段的 maxlength 属性值。 |
name | 设置或返回密码字段的 name 属性值。 |
pattern | 设置或返回密码字段的 pattern 属性值。 |
placeholder | 设置或返回密码字段的 placeholder 属性值。 |
readOnly | 设置或返回密码字段是否为只读。 |
required | 设置或返回在提交表单之前是否必须填写密码字段。 |
size | 设置或返回密码字段的 size 属性值。 |
type | 返回密码字段是哪种类型的表单元素。 |
value | 设置或返回密码字段的 value 属性值。 |
Input Password 对象方法
方法 | 描述 |
---|---|
select() | 选取密码字段的内容。 |
- 上一页 <input> number
- 下一页 <input> radio