h5-文字框,
h5-文字框
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>文字框</title> 6 </head> 7 <body> 8 <!-- form是表單,內部可以包含多個控制項, 9 控制項內可以輸入值。10 我們是以表單為單元進行提交,一次要提交一個表單所包含所有控制項的值。11 表單只是用來定提交的範圍。12 表單是透明的。13 #:表示無處可提交。在有伺服器時可提交給伺服器,即是填入伺服器位址取代#。14 -->15 <form action="#">16 <p>17 <!-- 加標籤:18 在input裡加入屬性id,並起名“account”,設定文字框的唯一id,19 而後,在“帳號:”前加上lable for="文字框的id"來捆綁標籤20 從而實現,點擊文字“帳號:”也可以進行文字框輸入。21 -->22 <label for="account">帳號:</label>23 <input type="texts" id="account"/>24 </p>25 <p>26 <label for="password">密碼:</label>27 <input type="pwd" id="password"/>28 </p>29 <!-- 單選框:在input裡添加屬性name,讓選項使用同名30 互斥,即可實現單選31 -->32 <p>33 性別:34 <input type="radio" checked id="male" name="sex"/>35 <label for="male">男</label>36 <input type="radio" id="female" name="sex"/>37 <label for="female">女</label>38 </p>39 <p>40 興趣:41 <input type="checkbox" checked id="basketball">42 <label for="basketball">籃球</label>43 <input type="checkbox" id="football">44 <label for="football">足球</label>45 </p>46 <p>47 <!-- value:按鈕的名稱;button:需用js進行定義 -->48 <input type="submit" value="提交"/>49 <input type="reset" value="重設"/>50 <input type="button" value="取消"/>51 </p>52 </form>53 </body>54 </html>