注釋:autocomplete 適用于 form 標(biāo)簽,以及以下類型的 input 標(biāo)簽:text, search, url, telephone, email, password, datepickers, range 以及 color。
當(dāng)用戶在自動(dòng)完成域中開始輸入時(shí),瀏覽器應(yīng)該在該域中顯示填寫的選項(xiàng):
form action= demo_form.asp method= get autocomplete= on First name: input type= text name= fname / br / Last name: input type= text name= lname / br / E-mail: input type= email name= email autocomplete= off / br / input type= submit / /form
親自試一試
注釋:在某些瀏覽器中,您可能需要啟用自動(dòng)完成功能,以使該屬性生效。
親自試一試
注釋:如需引用一個(gè)以上的表單,請使用空格分隔的列表。
 form action= demo_form.asp method= get id= user_form E-mail: input type= email name= userid / br /  input type= submit html' target='_blank'>value= Submit /  br /  input type= submit formaction= demo_admin.asp value= Submit as admin /  br /  input type= submit formnovalidate= true value= Submit without validation /  br /  /form 
親自試一試
注釋:這些屬性對(duì)于創(chuàng)建不同的提交按鈕很有幫助。
注釋:list 屬性適用于以下類型的 input 標(biāo)簽:text, search, url, telephone, email, date pickers, number, range 以及 color。
Webpage: input type= url list= url_list name= link / datalist id= url_list option label= W3Schools value= http://www.w3school.com.cn / option label= Google value= http://www.google.com / option label= Microsoft value= http://www.microsoft.com / /datalist
親自試一試
step 屬性為輸入域規(guī)定合法的數(shù)字間隔(如果 step= 3 ,則合法的數(shù)是 -3,0,3,6 等)。
注釋:min、max 和 step 屬性適用于以下類型的 input 標(biāo)簽:date pickers、number 以及 range。
下面的例子顯示一個(gè)數(shù)字域,該域接受介于 0 到 10 之間的值,且步進(jìn)為 3(即合法的值為 0、3、6 和 9):
Points: input type= number name= points min= 0 max= 10 step= 3 /
親自試一試
注釋:novalidate 屬性適用于 form 以及以下類型的 input 標(biāo)簽:text, search, url, telephone, email, password, date pickers, range 以及 color.
form action= demo_form.asp method= get novalidate= true E-mail: input type= email name= user_email / input type= submit / /form
親自試一試
模式(pattern) 是正則表達(dá)式。您可以在我們的 JavaScript 教程中學(xué)習(xí)到有關(guān)正則表達(dá)式的內(nèi)容。
注釋:pattern 屬性適用于以下類型的 input 標(biāo)簽:text, search, url, telephone, email 以及 password。
下面的例子顯示了一個(gè)只能包含三個(gè)字母的文本域(不含數(shù)字及特殊字符):
Country code: input type= text name= country_code pattern= [A-z]{3} title= Three letter country code / 親自試一試
注釋:placeholder 屬性適用于以下類型的 input 標(biāo)簽:text, search, url, telephone, email 以及 password。
提示(hint)會(huì)在輸入域?yàn)榭諘r(shí)顯示出現(xiàn),會(huì)在輸入域獲得焦點(diǎn)時(shí)消失:
input type= search name= user_search placeholder= Search W3School /
親自試一試
注釋:required 屬性適用于以下類型的 input 標(biāo)簽:text, search, url, telephone, email, password, date pickers, number, checkbox, radio 以及 file。
Name: input type= text name= usr_name required= required /
親自試一試
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。
新聞熱點(diǎn)
疑難解答
圖片精選