HTML DOM Input Image 對(duì)象

2023-04-10 10:12 更新

Input Image 對(duì)象表示使用 type="image"元素的 HTML <input> 元素。

訪問Input Image 對(duì)象

你可以使用 getElementById() 函數(shù)來訪問使用 type="image" 屬性的 <input> 元素:

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

提示: 你同樣可以通過表單的元素集合來訪問 Input Datetime 對(duì)象。

創(chuàng)建 Input Image 對(duì)象

你可以使用 document.createElement() 方法來創(chuàng)建使用 type="image" 屬性的 <input> 元素:

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

Input Image 對(duì)象屬性

= HTML5新增屬性。
Property 描述
alt 設(shè)置或返回 input image 的 alt 屬性值
autofocus 設(shè)置或返回 input image 是否在頁(yè)面加載后自動(dòng)獲取焦點(diǎn)
defaultValue 設(shè)置或返回 input image 默認(rèn)值
disabled 設(shè)置或返回 input image 是否被禁用
form 返回包含 input image 的表單引用
formAction 設(shè)置或返回 input image 的 formaction 屬性值
formEnctype 設(shè)置或返回 input image 的 formenctype 屬性值
formMethod 設(shè)置或返回 input image 的 formmethod 屬性值
formNoValidate 設(shè)置或返回 form-data 在提交時(shí)是否應(yīng)該驗(yàn)證
formTarget 設(shè)置或返回 input image 的 formtarget 屬性值
height 設(shè)置或返回 input image 的 height 屬性值
name 設(shè)置或返回 input image 的 name 屬性值
src 設(shè)置或返回 input image 的 src 屬性值
type 返回 input image 的表單元素類型
value 設(shè)置或返回 input image 的 value 屬性值
width 設(shè)置或返回 input image 的 width 屬性值

標(biāo)準(zhǔn)屬性和事件

Input Datetime 對(duì)象同樣支持標(biāo)準(zhǔn) 屬性事件


相關(guān)文章

HTML 教程: HTML 表單

HTML 參考手冊(cè): HTML <input> 標(biāo)簽

HTML 參考手冊(cè): HTML <input> type 屬性

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)