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");
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 屬性