html


<input>為html中的輸入框
在html5中加入了新的input類型

html:

<input type="text">  普通輸入框

<input type="textarea">  大文本輸入框

<input type="password">  與text一樣,只不過輸入的內容會用圓點或者星號隱藏
<input type="submit" value="Submit"> 提交表單能容,與<form></form>聯用,value是顯示在提交按鈕上的文字

<input type="radio" name="sex" value="male" checked>Male 單選,name一樣的中只能選其中之一 <br> <input type="radio" name="sex" value="female">Female

<input type="checkbox" name="vehicle" value="Bike">I have a bike 復選 <br> <input type="checkbox" name="vehicle" value="Car">I have a car

<input type="button" onclick="alert('Hello World!')" value="Click Me!"> 按鈕,onclick是點擊后的時間響應,可以跟function: onclick="hello()" javascript里:function hello(){alert('Hello World!');}

html5:

<input type="email" name="user_email" /> email驗證,只能輸入email

<input type="url" name="user_url" /> url驗證,只能輸入url

<input type="number"name="points" step="3" min="1" max="11" /> 數字驗證,最小1,最大不超過11,間隔為3則只能輸入1,4,7,10

<input type="range" name="points" step="3" min="1" max="11" /> 顯示為最小為1,最大不超過11,間隔為3的滑動條,只能選擇1,4,7,10,滑動條最右端為11,所以不能拉到最后。

HTML5 擁有多個可供選取日期和時間的新輸入類型:

  • date - 選取日、月、年   <input type="date" name="user_date" /> 

  • month - 選取月、年

  • week - 選取周和年

  • time - 選取時間(小時和分鍾)

  • datetime - 選取時間、日、月、年(UTC 時間)  似乎有問題- -,我的瀏覽器無效

  • datetime-local - 選取時間、日、月、年(本地時間)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM