HTML DOM Input Image 物件
Input Image 物件
Input Image 物件表示 type="image" 的 HTML <input> 元素。
訪問 Input Image 物件
您可以透過使用 getElementById() 訪問 type="image" 的 <input> 元素
var x = document.getElementById("myImage");
提示:您也可以透過搜尋表單的 elements 集合來訪問 <input type="image">。
建立 Input Image 物件
您可以透過使用 document.createElement() 方法建立一個 type="image" 的 <input> 元素
var x = document.createElement("INPUT");
x.setAttribute("type", "image");
Input Image 物件屬性
屬性 | 描述 |
---|---|
alt | 設定或返回輸入影像的 alt 屬性值 |
autofocus | 設定或返回頁面載入時輸入影像是否自動獲取焦點 |
defaultValue | 設定或返回輸入影像的預設值 |
disabled | 設定或返回輸入影像是否停用 |
form | 返回包含輸入影像的表單的引用 |
formAction | 設定或返回輸入影像的 formaction 屬性值 |
formEnctype | 設定或返回輸入影像的 formenctype 屬性值 |
formMethod | 設定或返回輸入影像的 formmethod 屬性值 |
formNoValidate | 設定或返回提交時是否應驗證表單資料 |
formTarget | 設定或返回輸入影像的 formtarget 屬性值 |
height | 設定或返回輸入影像的 height 屬性值 |
name | 設定或返回輸入影像的 name 屬性值 |
src | 設定或返回輸入影像的 src 屬性值 |
type | 返回輸入影像的表單元素型別 |
value | 設定或返回輸入影像的 value 屬性值 |
width | 設定或返回輸入影像的 width 屬性值 |
標準屬性和事件
相關頁面
HTML 教程:HTML 表單
HTML 參考:HTML <input> 標籤
HTML 參考:HTML <input> type 屬性