国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

directory search
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
characters

<input>類型的元素"image"用于創(chuàng)建圖形提交按鈕,即提交采取圖像而不是文本形式的按鈕。

<input id="image" type="image" src="https://raw.githubusercontent.com/mdn/learning-area/master/html/forms/image-type-example/login.png">

無 - 不應(yīng)該指定值屬性。

活動

沒有。

支持的通用屬性

所有,src,寬度,高度,形式,表單類型,表單方法,formnovalidate,格式

IDL屬性

沒有。

方法

沒有。

<input type="image">元素不接受value屬性。要顯示的圖像的路徑在src屬性中指定。

使用圖像輸入

所述<input type="image">元件是一個替換元件(元件,其內(nèi)容也不會產(chǎn)生或受到CSS層直接管理),在大致相同的方式作為常規(guī)行為<img>元件,但具有提交按鈕的功能。

基本的圖像輸入功能

讓我們來看一個基本的例子,其中包含了您需要使用的所有基本功能(這些功能與<img>元素上的功能完全相同)。

<input id="image" type="image" width="100" height="30" alt="Login"
       src="https://raw.githubusercontent.com/mdn/learning-area/master/html/forms/image-type-example/login.png">
  • src屬性用于指定要在按鈕中顯示的圖像的路徑。

  • alt屬性為圖像提供替代文本,因此屏幕閱讀器用戶可以更好地了解該按鈕的用途。如果由于任何原因無法顯示圖像(例如路徑拼寫錯誤),也會顯示該圖像。如果可能的話,使用與使用標(biāo)準提交按鈕時所用標(biāo)簽相匹配的文本。

  • widthheight屬性用來指定的寬度和高度的圖像應(yīng)在被示出,以像素為單位。該按鈕與圖像大小相同; 如果你需要按鈕的點擊區(qū)域大于圖像,你將需要使用CSS(例如padding)。另外,如果只指定一個尺寸,則另一個尺寸會自動調(diào)整,以便圖像保持其原始高寬比。

覆蓋默認的表單行為

<input type="image"> 元素 - 像常規(guī)的提交按鈕 - 可以接受一些重寫默認表單行為的屬性:

formactionHTML5處理由input元素提交的信息的程序的URI,在這里如果指定了image,它將覆蓋action元素的表單所有者的屬性。formenctypeHTML5如果輸入元素是圖像,則此屬性指定用于將表單提交給服務(wù)器的內(nèi)容的類型。可能的值是:

  • application/x-www-form-urlencoded:如果未指定屬性,則為默認值。

  • text/plain.

如果指定了該屬性,則將覆蓋enctype該元素的表單所有者的屬性。

formmethodHTML5在圖像輸入元素中,該屬性指定瀏覽器用于提交表單的HTTP方法??赡艿闹凳牵?/p>

  • post:表單中的數(shù)據(jù)包含在表單的主體中,并發(fā)送到服務(wù)器。

  • get:來自表單的數(shù)據(jù)被附加到表單屬性URI,并帶有'?' 作為分隔符,并將生成的URI發(fā)送到服務(wù)器。當(dāng)表單沒有副作用并且只包含ASCII字符時使用此方法。

如果指定,則此屬性將覆蓋method該元素的表單所有者的屬性。

formnovalidateHTML5這個布爾屬性指定表單在提交時不被驗證。如果指定了該屬性,則將覆蓋novalidate該元素的表單所有者的屬性。

formtargetHTML5此屬性是一個名稱或關(guān)鍵字,指示在提交表單后顯示收到的響應(yīng)的位置。這是瀏覽上下文的名稱或關(guān)鍵字(例如,選項卡,窗口或內(nèi)聯(lián)框架)。如果指定了該屬性,則將覆蓋target該元素的表單所有者的屬性。以下關(guān)鍵字具有特殊含義:

  • _self:將響應(yīng)加載到與當(dāng)前瀏覽環(huán)境相同的瀏覽環(huán)境中。如果未指定屬性,則此值為默認值。

  • _blank:將響應(yīng)加載到新的未命名瀏覽上下文中。

  • _parent:將響應(yīng)加載到當(dāng)前父瀏覽上下文中。如果沒有父項,則此選項的行為方式與_self

  • _top:將響應(yīng)加載到頂級瀏覽上下文(即,作為當(dāng)前祖先的瀏覽上下文,并且沒有父級)。如果沒有父項,則此選項的行為方式與_self

使用x和y數(shù)據(jù)點

當(dāng)您使用與創(chuàng)建按鈕提交表單<input type="image">,兩個額外的數(shù)據(jù)點通過瀏覽器自動提交到服務(wù)器- xy。您可以在我們的XY坐標(biāo)示例中看到這一點。

例如,當(dāng)您單擊圖像提交表單時,您將看到作為參數(shù)附加到URL的數(shù)據(jù)"?x=52&y=55"。如果圖像輸入具有name屬性,那么請記住,指定的名稱是以每個屬性為前綴的,所以如果name"position",那么返回的坐標(biāo)將被格式化為URL "?position.x=52&position.y=55"。當(dāng)然,這也適用于所有其他屬性。

這些是鼠標(biāo)點擊提交表單的圖像的X和Y坐標(biāo),其中(0,0)是圖像的左上角。當(dāng)點擊圖像的位置非常重要時,可以使用這些元素,例如,您可能會有一個地圖,單擊時會將點擊的坐標(biāo)發(fā)送到服務(wù)器。服務(wù)器端代碼然后找出被點擊的位置,并返回附近的地方的信息。

在我們上面的例子中,我們可以編寫服務(wù)器端代碼來確定提交的坐標(biāo)點擊了什么顏色,并保留了人們所喜歡的顏色。

例子

以下示例顯示了與以前相同的按鈕,但包含在典型登錄表單的上下文中。

HTML看起來像這樣:

<form>  <p>Login to your account</p>  <div>    <label for="userId">User ID</label>    <input type="text" id="userId" name="userId">  </div>  <div>    <label for="pwd">Password</label>    <input type="password" id="pwd" name="pwd">  </div>  <div>    <input id="image" type="image" src="https://raw.githubusercontent.com/mdn/learning-area/master/html/forms/image-type-example/login.png" alt="Login" width="100">  </div></form>

現(xiàn)在一些簡單的CSS讓基本元素更加整齊:

div {
  margin-bottom: 10px;}label {
  display: inline-block;
  width: 70px;
  text-align: right;
  padding-right: 10px;}

規(guī)范

規(guī)范

狀態(tài)

WHATWG HTML生活標(biāo)準該規(guī)范中'<input type ='image'>''的定義。

生活水平

HTML5該規(guī)范中的<input type =“image”>“的定義。

建議

瀏覽器兼容性

Feature

Chrome

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Feature

Android

Firefox Mobile (Gecko)

IE Mobile

Opera Mobile

Safari Mobile

Basic support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Previous article: Next article: