咱們先來看下今天咱們需要學習的內容,理解起來很簡單,像我這種英語不好的只是需要背幾個單詞
在HTML中創建表單需要用到的最基本的代碼和格式
1 <form method="post/get" > 2 <!--文本輸入--> 3 <input type="text" /> <!--文本框--> 4 <input type="password" /> <!--密碼框--> 5 <input type="hidden" /> <!--隱藏域--> 6 <textarea></textarea> <!--文本域--> 7 <!--按鈕輸入--> 8 <input type="submit" /> <!--提交按鈕--> 9 <input type="button /> <!--普通按鈕--> 10 <input type="image" /> <!--圖片按鈕--> 11 <input type="reset" /> <!--重置按鈕--> 12 <!--選擇輸入--> 13 <input type="redio" name="" checked="checked" value="" /> <!--name是用來分組的,checked是默認值,value是命名按鈕名字的--> 14 <input type="checkbox" name="" checked="checked" value=""/> <!--復選或者是多選--> 15 <input type="file" /> <!--上傳圖片--> 16 <select> <!--下拉菜單--> 17 <option value="值">內容</option> 18 <option value="值">內容</option> 19 <option value="值">內容</option> 20 <option value="值">內容</option> 21 </select> 22 </form>
以上就是咱們需要記住的一點東西
看起來很復雜、很麻煩
咱們來理一下思路
總共分為三大類,每類分為四種,拋出textarea\select剩下的都是input tpye= 這個樣式開頭的
那 文本類的就是下面的四個
input type="text"
.................password
.................hidden
<textarea><textarea/>
按鈕類的
input type="submit"
..................button
..................reset
..................image
選擇輸入
input type="redio"
..................checkbox
..................file
<select><option></option></select>
最后后咱們來補充一個,小內容,關於選擇類和按鈕類的綜合體
咱們在一些網站去注冊的帳號的時候,咱們選擇選項比如說男、女,不一定非要點擊按鈕才可以,點擊漢字也能選擇的上,那這個小技巧是什么,咱們往下看
<lable for="id">按鈕內容</lable>
1 <input type="redio" name="" checked="checked" value="男" id="001"/> 2 <lable for="001">男</lable>
那這樣咱們去點擊前面的按鈕也可以,點擊這個字“男”也可以選擇上,省去了鼠標、觸摸板使用時的很多不必要的麻煩