欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

007第7课:细说表单(重点)+后台框架

程序员文章站 2022-05-01 22:22:01
...

007第7课:细说表单(重点)+后台框架

  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>细说表单(重点)</title>
  8. </head>
  9. <br>
  10. <h2>用户注册</h2>
  11. <!-- form + input + select +button ... -->
  12. <!-- <form action="verify.php" method="post">
  13. <input type="" name="username" value="admin" />
  14. <input type="password" name="password" value="" />
  15. <button>提交</button>
  16. </form> -->
  17. <!-- http://127.0.0.1:5500/20211222/verify.php?username=admin -->
  18. <!-- http://127.0.0.1:5500/20211222/verify.php?username=admin&password=12345 -->
  19. <!-- 文本框 -->
  20. <form action="verify.php" method="post" style="display: grid;gap:10px">
  21. <div>
  22. <label for="username">用户名:</label>
  23. <!-- label的for属性和input的id属性必须一致 -->
  24. <input type="text" name="username" id="username" value="" placeholder="至少8位" required />
  25. <!-- placeholder="至少8位" required 提示位数,以及强制填写才能提交 -->
  26. </div>
  27. <!-- 密码框 -->
  28. <div>
  29. <label for="password">密码:</label>
  30. <!-- label的for属性和input的id属性必须一致 -->
  31. <input type="password" name="password" id="password" value="" placeholder="数字+字母,至少6位" required />
  32. <!-- placeholder="至少8位" required 提示位数,以及强制填写才能提交 -->
  33. <button onclick="showPassword(this,this.form.password)" type="button">查看</button>
  34. </div>
  35. <!-- 邮箱 -->
  36. <div>
  37. <label for="email">密码:</label>
  38. <!-- label的for属性和input的id属性必须一致 -->
  39. <input type="email" name="email" id="email" value="" placeholder="类似:xxx@gmail.com" required />
  40. <!-- placeholder="至少8位" required 提示位数,以及强制填写才能提交 -->
  41. </div>
  42. <!-- 单选按钮 -->
  43. <!-- div>label+input*2 -->
  44. <div><label for="">性别</label>
  45. <input type="radio" name="gender" id="" value="male"><label for="male"></label>
  46. <input type="radio" name="gender" id="" value="female"><label for="female"></label>
  47. </div>
  48. <!-- 复选框 -->
  49. <div>
  50. <lable>爱好:</lable>
  51. <input type="checkbox" name="hobby[0]" id="game">
  52. <lable for="game">游戏</lable>
  53. <input type="checkbox" name="hobby[1]" id="trave">
  54. <lable for="trave">旅游</lable>
  55. <input type="checkbox" name="hobby[2]" id="shoot">
  56. <lable for="shoot">摄影</lable>
  57. </div>
  58. <!-- 默认提交,重置 -->
  59. <button></button><button></button><button></button>
  60. <!-- 内联框架和多媒体 -->
  61. <!-- 内联标签:画中画 -->
  62. <a href="https://map.baidu.com/search/%E4%B8%9C%E8%8E%9E%E5%B8%82/@12663667,2618456.75,12z?querytype=s&wd=%E4%B8%9C%E8%8E%9E%E5%B8%82&c=119&provider=pc-aladin&pn=0&device_ratio=1&da_src=shareurl" target="map">东莞市</a>
  63. <iframe src="" frameborder="1" width="500" height="500" name="map"></iframe>
  64. <!-- 多媒体 -->
  65. <video width="" height="" controls>
  66. </video>
  67. <button>提交</button>
  68. </form>
  69. <script>
  70. function showPassword(btn, ele) {
  71. if (ele.type === "password") {
  72. ele.type = "text";
  73. btn.textContent = "隐藏";
  74. } else {
  75. ele.type = "password";
  76. btn.textContent = "显示";
  77. }
  78. }
  79. </script>
  80. </body>
  81. </html>