亚洲国产日韩欧美一区二区三区,精品亚洲国产成人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
文字

<input>類型的元素"reset"被渲染為重置按鈕 - 單擊一個將重置所有輸入的形式,它是其初始值的一部分。

<input type="reset" value="Reset the form">

注意:通常不建議在表單中包含重置按鈕。它們很少有用,而且當意外按下而不是主動按下提交按鈕時往往會使用戶沮喪。

用作按鈕標簽的DOMString

活動

點擊

支持的通用屬性

類型和價值

IDL屬性

方法

沒有

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

<input type="reset" value="Reset the form">

如果你不指定一個value,你會得到一個默認標簽Reset的按鈕:

<input type="reset">

使用重置按鈕

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

一個簡單的重置按鈕

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

<form> 
  <div>    <label for="example">Type in some sample text</label>    <input id="example" type="text">  </div>  <div>    <input type="reset" value="Reset the form">  </div></form>

這呈現(xiàn)如下:

嘗試在文本字段中輸入一些文本,然后按下重置按鈕。

添加重置鍵盤快捷鍵

鍵盤快捷鍵可讓用戶使用鍵盤上的鍵或鍵組合來觸發(fā)按鈕。要將鍵盤快捷鍵添加到重置按鈕可以使用accesskey全局屬性。

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

<form>  <div>    <label for="example">Type in some sample text</label>    <input id="example" type="text">  </div>  <div>    <input type="reset" value="Reset the form"
     accesskey="r">  </div></form>

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

禁用并啟用重置按鈕

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

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

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

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

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

驗證

按鈕不參與約束驗證; 他們沒有真正的價值被約束。

示例

我們已經(jīng)包含上面的簡單例子。關于重置按鈕沒有什么可說的。

規(guī)范

規(guī)范

狀態(tài)

HTML生活標準在該規(guī)范中定義'<input type ='reset'>''。

生活水平

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

建議

瀏覽器兼容性

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)

上一篇: 下一篇: