1、type屬性裏新增的標籤:
(1) date、datetime、datetime-local、time、week、month這些是 type屬性裏表示時間類型的。(這些只在opera裏面支持)
例:
html
2、 其它新增的標籤
1.autocomplete
autocomplete:on|off;
當爲on的時候,瀏覽器能自動存儲用戶輸入的內容。當用戶返回到曾經填寫過值的頁 面時,瀏覽器能把用戶寫過的值自動填寫在相應的input框裏。免去了用後臺來作,來傳送數據的麻煩。
2.autofocus(谷歌支持)
autofocus:autofocus; 當頁面加載時使字段得到焦點,當type="hidden"時,沒法使用。一個頁面只能有一個autofocus字段聚焦。
例:<input autofocus type="search" value="請輸入信息"/>
3.placeholder(谷歌支持)
placeholder表示佔位符,當type="text"或type="email"等屬性時,提示用戶輸入的信息格式或內容 等。
例:代碼:
<p>placeholder(表示佔位符,在谷歌裏面支持)</p>
<p> 用戶名: <input type="text" name="fullname" placeholder="John Ratzenberger"></p>
<p>郵箱: <input type="email" name="address" placeholder=""></p>
<p> 密碼: <input type="password" name="password"></p>
<p>Description: <input type="text" name="desc" placeholder="My Email Account"></p>
4.list(opera支持)
list引用detalist元素。若是定義,則一個下拉列表可用於向輸入字段插入值。
例:代碼:
網址: <input name=hp type=url list=hpurls/>
<datalist id=hpurls>
<option value="http://www.google.com/" label="Google"/>
<option value="http://www.reddit.com/" label="Reddit"/>
</datalist>
5.max、min屬性來限制數值的範圍大小。 minheight、maxheight屬性限制字符串的長度。
6.required(opera 支持)
required:true|false;是一個布爾型屬性,定義輸入字段的值是不是必需 的,當指定時,這個元素是必須的。
當使用下列類型使沒法使用:hidden,images,button,submit,reset由於有 value值去定義。required屬性省去了頁面要用*或其餘內容做特殊標記,讓用戶來知道是必填的內容,也免去了驗證的麻煩。
例:代 碼:<h1>用戶註冊</h1>
<form action="" method="">
<p> 郵箱地址:
<input id="username" type="email" required=true name=un/>
</p>
<p> 密碼:
<input id="password1" type=password required name=up/>
</p>
<p> 確認密碼:
<input id="password2" type=password required name=up/>
</p>
<input type=submit value="提交"><br/>
</form>
瀏覽器