HTML DOM インプット パスワード オブジェクト
- 前のページ <input> ナンバー
- 次のページ <input> ラジオ
Input Password オブジェクト
Input Password オブジェクトは type="password" を持つ HTML <input> 要素を表します。
Input Password オブジェクトにアクセス
getElementById() メソッドを使用して type="password" の <input> 要素にアクセスできます:
var x = document.getElementById("myPsw");
ヒント:フォームの検索を通じてもアクセスできます。 elements コレクション <input type="password"> にアクセスするために使用します。
Input Password オブジェクトの作成
document.createElement() メソッドを使用して type="password" の <input> 要素を作成できます:
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> ナンバー
- 次のページ <input> ラジオ