HTML DOM Input Password Obheto

Objek Input Password

Ang Objek Input Password ay naglalarawan ng elemento HTML <input> na may type="password".

Pumunta sa Objek Input Password

Maaaring gamitin ang getElementById() upang pumunta sa elemento <input> na may type="password":

var x = document.getElementById("myPsw");

親自試試

Paalala:Maaari mo ring hanapin ang form sa pamamagitan ng Koleksyon ng elements Upang pumunta sa <input type="password">.

Lumikha ng Objek Input Password

Maaaring gamitin ang methodong document.createElement() upang lumikha ng elemento <input> na may 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 Password 對象同時支持標準屬性事件

相關頁面

HTML 教程:HTML 表單

HTML 參考手冊:HTML <input> 标籤

HTML 參考手冊:HTML <input> type 屬性