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

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

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

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

用作按鈕標簽的DOMString

活動

點擊

支持的通用屬性

類型和價值

IDL屬性

方法

沒有

<input type="submit">元素的value屬性包含一個 DOMString作為按鈕的標簽

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

如果你不指定一個value,你會得到一個默認標簽,如提交 / 提交查詢(取決于瀏覽器)的按鈕:

<input type="submit">

使用提交按鈕

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

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

一個簡單的提交按鈕

我們將開始創(chuàng)建一個簡單的提交按鈕:

<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ā)送到服務器的數(shù)據(jù)鍵/值對text=mytext將根據(jù)您在文本字段中輸入的文本而定。提交數(shù)據(jù)的地點和方式取決于您如何設置<form>屬性(和其他詳細信息) 。

添加提交鍵盤快捷鍵

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

在這個例子中,s被指定為訪問鍵(您需要按s加上您的瀏覽器/操作系統(tǒ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>

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

禁用和啟用提交按鈕

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

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

您可以在運行時通過設置disabledtrue或來啟用和禁用按鈕false; 在JavaScript中,這看起來像btn.disabled = true。

注意:請參閱<input type="button">頁面以獲取有關啟用/禁用按鈕的更多信息。

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

驗證

提交按鈕不參與約束驗證; 他們沒有被可約束的值

例子

我們已經包含上面的簡單例子。關于提交按鈕沒有什么可說的。

規(guī)范

規(guī)范

狀態(tài)

HTML生活標準在該規(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)

Previous article: Next article: