亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

目錄 搜尋
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
文字

"submit"類型的<input>元素呈現(xiàn)為提交按鈕 - 單擊一個(gè)將嘗試提交表單到服務(wù)器。

<input type="submit" value="Submit to me">

用作按鈕標(biāo)簽的DOMString

活動(dòng)

點(diǎn)擊

支持的通用屬性

類型和價(jià)值

IDL屬性

方法

沒(méi)有

<input type="submit">元素的value屬性包含一個(gè) DOMString作為按鈕的標(biāo)簽

<input type="submit" value="Submit to me">

如果你不指定一個(gè)value,你會(huì)得到一個(gè)默認(rèn)標(biāo)簽,如提交 / 提交查詢(取決于瀏覽器)的按鈕:

<input type="submit">

使用提交按鈕

<input type="submit">按鈕用于提交表單。如果你想創(chuàng)建一個(gè)自定義的按鈕,然后使用JavaScript自定義行為,你需要使用<input type="button">或更好的<button>元素。

但是,您需要注意的是,如果您只在表單(例如<button>My button</button>)中包含單個(gè)按鈕元素,則瀏覽器會(huì)將其計(jì)為提交按鈕。除了可能要包含的任何其他按鈕之外,還需要顯式聲明提交按鈕。

一個(gè)簡(jiǎn)單的提交按鈕

我們將開(kāi)始創(chuàng)建一個(gè)簡(jiǎn)單的提交按鈕:

<form> 
  <div>    <label for="example">Let's submit some text</label>    <input id="example" type="text" name="text">  </div>  <div>    <input type="submit" value="Submit to me">  </div></form>

呈現(xiàn)如下:

嘗試在文本字段中輸入一些文本,然后提交表單。

提交后,在這種情況下發(fā)送到服務(wù)器的數(shù)據(jù)鍵/值對(duì)text=mytext將根據(jù)您在文本字段中輸入的文本而定。提交數(shù)據(jù)的地點(diǎn)和方式取決于您如何設(shè)置<form>屬性(和其他詳細(xì)信息) 。

添加提交鍵盤快捷鍵

鍵盤快捷鍵(也稱為訪問(wèn)鍵和鍵盤等價(jià)物)可讓用戶使用鍵盤上的鍵或鍵組合來(lái)觸發(fā)按鈕。要將鍵盤快捷鍵添加到提交按鈕 - 就像使用任何<input>有意義的鍵一樣 - 可以使用accesskey全局屬性。

在這個(gè)例子中,s被指定為訪問(wèn)鍵(您需要按s加上您的瀏覽器/操作系統(tǒng)組合的特定修飾鍵;請(qǐng)參閱accesskey這些鍵的有用列表)。

<form>  
    <div>    
        <label for="example">Let's submit some text</label>    
        <input id="example" type="text" name="text">  
    </div>  
    <div>    
        <input type="submit" value="Submit to me" accesskey="s">  
    </div>
</form>

注意:以上例子的問(wèn)題當(dāng)然是用戶不知道訪問(wèn)密鑰是什么!在真實(shí)網(wǎng)站中,您必須以不干擾網(wǎng)站設(shè)計(jì)的方式提供此信息(例如,通過(guò)提供易于訪問(wèn)的鏈接指向網(wǎng)站訪問(wèn)鍵的信息)。

禁用和啟用提交按鈕

要禁用提交按鈕,只需disabled在其上指定全局屬性,如下所示:

<input type="submit" value="Disabled" disabled>

您可以在運(yùn)行時(shí)通過(guò)設(shè)置disabledtrue或來(lái)啟用和禁用按鈕false; 在JavaScript中,這看起來(lái)像btn.disabled = true

注意:請(qǐng)參閱<input type="button">頁(yè)面以獲取有關(guān)啟用/禁用按鈕的更多信息。

:Firefox將不像其他的瀏覽器,默認(rèn)情況下,堅(jiān)持動(dòng)態(tài)禁用狀態(tài)一的<button>整個(gè)頁(yè)面加載。使用該autocomplete屬性來(lái)控制此功能。

驗(yàn)證

提交按鈕不參與約束驗(yàn)證; 他們沒(méi)有被可約束的值

例子

我們已經(jīng)包含上面的簡(jiǎn)單例子。關(guān)于提交按鈕沒(méi)有什么可說(shuō)的。

規(guī)范

規(guī)范

狀態(tài)

HTML生活標(biāo)準(zhǔn)在該規(guī)范中定義了<input type =“submit”>''。

生活水平

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

建議

瀏覽器兼容性

Feature

Chrome

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

1.0

1.0 (1.7 or earlier)

(Yes)

(Yes)

1.0

Feature

Android

Firefox Mobile (Gecko)

IE Mobile

Opera Mobile

Safari Mobile

Basic support

(Yes)

4.0 (4.0)

(Yes)

(Yes)

(Yes)

上一篇: 下一篇: