表單標簽
<!--表單標簽:收集用戶信息--> <html> <head> <body> <!--表單域:包含表單元素的區域 action="url地址" method="提交方式" name="表單域名稱"--> <!--表單元素:input:輸入表單元素、select:下拉表單元素、textarea:文本域元素--> <!--input屬性: text文本 button定義可點擊按鈕 CheckBox定義復選框 file定義輸入字段和瀏覽按鈕,供文件上傳 hidden隱藏的輸入字段 image圖像形式提交 password密碼字段 radio單選按鈕 reset重置按鈕 submit提交按鈕 name:定義元素名稱:針對后臺人員使用 value:規定元素值:針對后臺人員使用 checked:規定首次加載時被選中:針對單選和復選按鈕 maxlength:輸入做大長度 --> <!--lable標簽:綁定表單元素,增加用戶體驗--> <form accept="xxx.php" method="get"> <label for="text">用戶名:</label> <input type="text" id="text" name="name" ><br /><!--text文本--> <label for="password">密碼</label> <input type="password" name="pwd" maxlength="15" id="password"><br /><!--password密碼字段--> 性別: <label for="nan">男</label> <input type="radio" name="sex" value="男" id="nan"> <label for="nv">女</label> <input type="radio" name="sex" value="女" id="nv"> <!--radio單選按鈕--><br /> 愛好: 吃飯<input type="checkbox" name="hobby" value="吃飯" checked="checked"> 睡覺<input type="checkbox" name="hobby" value="睡覺"> 打豆豆<input type="checkbox"name="hobby"><br /><!--CheckBox定義復選框--> <input type="submit" value="免費注冊"><br /> <input type="reset" value="重置填寫"> <input type="button" value="獲取短信驗證碼"><br /><!--后期結合js使用--> <input type="file"><br /> <!--select下來標簽:多項選擇--> 籍貫: <select> <option>四川</option> <option selected="selected">北京</option><!--默認選項--> <option>山東</option> <option>上海</option> <option>廣東</option> </select> <br /> <!--textarea文本域:定義多行文本--> 今日反饋: <textarea cols="100" rows="5"><!--cols="每行字數" rows="行數"--> 你是豬 </textarea> </form> </body> </head> </html>
小胖專屬學習分享

浙公網安備 33010602011771號