- 作业

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <h3>用户注册:</h3>
  11. <form action="check.php" method="GET" style="display: grid;gap:0.5em"><!--style="display: grid;" 默认显示为块元素 可实现自动拉伸 -->
  12. <fieldset>
  13. <legend >必填项</legend>
  14. <div>
  15. <label for="user">账户:</label></label>
  16. <input type="text" name="username" id="user" autofocus required placeholder="请输入帐号" value="admin" >
  17. </div>
  18. <div>
  19. <label for="psw">密码:</label></label>
  20. <input type="password" name="password" id="psw" required placeholder="请输入密码">
  21. </div>
  22. <div>
  23. <label for="email">邮箱:</label></label>
  24. <input type="email" name="email" id="email" required placeholder="demo@email.com">
  25. </div>
  26. </fieldset>
  27. <div>
  28. <!-- 单选框 -->
  29. <!-- 所有单选按钮的name值必须相同 -->
  30. <label for="secret">性别:</label>
  31. <input type="radio" name="gender" value="male"><label for=""></label>
  32. <input type="radio" name="gender" value="female"><label for=""></label>
  33. <input type="radio" name="gender" value="secret" checked id="secret"><label for="">保密</label>
  34. </div>
  35. <div>
  36. <!-- 复选框 -->
  37. <!-- 所有复选框的name属性值必须为数组且相同 -->
  38. <label for="">爱好:</label>
  39. <input type="checkbox" name="hobby[]" id="game"><label for="game">游戏</label>
  40. <input type="checkbox" name="hobby[]" id="trave"><label for="trave">旅游</label>
  41. <input type="checkbox" name="hobby[]" id="shoot" checked><label for="shoot">摄影</label>
  42. </div>
  43. <div>
  44. <label for="level">会员级别:</label>
  45. <select name="level" id="level">
  46. <option value="1">铜牌会员</option>
  47. <option value="2" selected >银牌会员</option>
  48. <option value="3" >金牌会员</option>
  49. <option value="4">钻石会员</option>
  50. </select>
  51. </div>
  52. <div>
  53. <!-- 带下拉列表的自定义搜索框 -->
  54. <label for="">搜索关键字:</label>
  55. <input type="text" list="kewords">
  56. <datalist id="kewords">
  57. <option value="html">html</option>
  58. <option value="javascript">javascript</option>
  59. <option value="js">js</option>
  60. <option value="css">css</option>
  61. </datalist>
  62. </div>
  63. <button>提交</button>
  64. </form>
  65. </body>
  66. </html>

- 笔记

label控件和input绑定
实现效果:点击帐号,input获取光标焦点
input type:text password email:自动审查input输入内容是否为邮箱


input常用属性
autofocus 页面刷新后自动获取焦点,一般是唯一
placeholder=”请输入帐号” input空数据时显示提示文字
required input非空判断,实现必填项效果
value=“admin” 给input添加一个默认值

type
text:文本输入
password:密码输入
email:自动判断input输入内容是否为邮箱
radio:单选框

checked input的type为radio时,添加checked可以让单选框默认选中

更多相关文章

  1. FROM表单实践以及心得
  2. 表单的制作
  3. 注册表单、基本选择器及上下文选择器
  4. 无线不能连接故障又一例
  5. html基础:form表单
  6. html内table表格的与form表单基础写法!
  7. 写用户注册表
  8. 初识初学表单
  9. Google Maps API申请 之 Android(安卓)Maps API

随机推荐

  1. 数据分析应关注AARRR模型的哪些指标
  2. 如何使用Git入门到熟练
  3. SQL今日一题(4):表连接
  4. 5月小复盘
  5. 如何进行数据图形化?
  6. 2020年Python文章盘点,我选出了个人TOP10
  7. 如何做好描述统计分析
  8. SQL今日一题(5):一题多解
  9. 数据分析中会常犯哪些错误,如何解决?
  10. 数学之美:数学究竟是如何被运用到生活中的