HTML DOM Input Image オブジェクト


Input Image オブジェクト

Input Image オブジェクトは、type="image" 要素を使用した HTML <input> 要素を表します。

Input Image オブジェクトへのアクセス

getElementById() 関数を使用して、type="image" 属性を使用した <input> 要素にアクセスできます:

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

ヒント:同様に、フォームの要素コレクションを使用して Input Datetime オブジェクトにアクセスできます。

Input Image オブジェクトの作成

document.createElement() メソッドを使用して、type="image" 属性を使用した <input> 要素を作成できます:

var x = document.createElement("INPUT");
x.setAttribute("type", "image");

Input Image オブジェクトのプロパティ

= HTML5 で追加されたプロパティ。
Property 説明
alt input image の alt 属性値を設定または返します。
autofocus input image がページ読み込み後に自動的にフォーカスを取得するかどうかを設定または返します。
defaultValue input image のデフォルト値を設定または返します。
disabled input image が無効になっているかどうかを設定または返します。
form input image を含むフォームへの参照を返します。
formAction input image の formaction 属性値を設定または返します。
formEnctype input image の formenctype 属性値を設定または返します。
formMethod input image の formmethod 属性値を設定または返します。
formNoValidate form-data を送信時に検証するかどうかを設定または返します。
formTarget input image の formtarget 属性値を設定または返します。
height input image の height 属性値を設定または返します。
name input image の name 属性値を設定または返します。
src input image の src 属性値を設定または返します。
type input image のフォーム要素タイプを返します。
value input image の value 属性値を設定または返します。
width input image の width 属性値を設定または返します。

標準プロパティとイベント

Input Datetime オブジェクトも標準プロパティととイベントをサポートしています。。


関連記事

HTML チュートリアル:HTML フォーム

HTML リファレンス:HTML <input> タグ

HTML リファレンス:HTML <input> の type 属性

その他の拡張