Blogger Information
Blog 31
fans 2
comment 0
visits 27676
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
一个实用的表单元素
霏梦
Original
611 people have browsed it

- 作者:霏梦

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>表单</title>
  7. <script>
  8. function showPwd(ele) {
  9. document.querySelector("#pwd-1").type = "text";
  10. }
  11. </script>
  12. <style>
  13. body{
  14. color: lightsteelblue;
  15. }
  16. h3{
  17. text-align: center;
  18. }
  19. form{
  20. width: 450px;
  21. margin: 30px auto;
  22. border-top: 1px solid #aaa;
  23. }
  24. form fieldset{
  25. border: 1px solid lightgreen;
  26. background-color: lightcyan;
  27. margin: 10px;
  28. }
  29. form fieldset legend{
  30. background-color:lightcyan;
  31. color: mediumaquamarine;
  32. padding: 5px 15px;
  33. border-radius: 10px;
  34. }
  35. form div{
  36. margin: 10px;
  37. }
  38. form p{
  39. text-align: center;
  40. }
  41. input:focus{
  42. background-color: lightpink;
  43. }
  44. form .btn:hover{
  45. background-color: coral;
  46. color: white;
  47. cursor: pointer;
  48. }
  49. </style>
  50. </head>
  51. <body>
  52. <h3>用户注册</h3>
  53. <!-- form+input -->
  54. <form action="" method="POST">
  55. <!-- 控件组 --filedse与legend成对出现>
  56. <fieldset>
  57. <legend>员工基本信息(必填)</legend>
  58. <div>
  59. <label for="username">账号:</label>
  60. <input
  61. type="text"
  62. id="username"
  63. name="username"
  64. placeholder="6-15位字符"
  65. autofocus
  66. required
  67. />
  68. </div>
  69. <div>
  70. <label for="email-id">邮箱:</label>
  71. <input
  72. type="email"
  73. name="email"
  74. id="email-id"
  75. placeholder="demo
  76. @example.com"
  77. required
  78. />
  79. </div>
  80. <div>
  81. <label for="pwd-1">密码:</label>
  82. <input
  83. type="password"
  84. name="password"
  85. id="pwd-1"
  86. placeholder="不少于8位且字母和数字"
  87. />
  88. <button onclick="showPwd()" id="btn" type="button">查看密码</button>
  89. </div>
  90. <div>
  91. <label for="pwd-2">确认:</label>
  92. <input type="password" name="password2" id="pwd-2" />
  93. </div>
  94. </fieldset>
  95. <fieldset>
  96. <legend>扩展信息(选填)</legend>
  97. <div>
  98. <label for="date-id"
  99. >出生日期: <input type="date" name="birthday" id="date-id"
  100. /></label>
  101. </div>
  102. <div>
  103. <!-- 单选按妞 -->
  104. <label>性别:</label>
  105. <input type="radio" name="male" id="male" /><label for="male"
  106. ></label
  107. >
  108. <input type="radio" name="female" id="female" /><label for="female"
  109. ></label
  110. >
  111. <input type="radio" name="secret" id="secret" checked /><label
  112. for="secret"
  113. >保密</label
  114. >
  115. </div>
  116. <div>
  117. <!-- 复选框 laber for与ID必须一致-->
  118. <label for="programme">我的爱好</label>
  119. <input
  120. type="checkbox"
  121. name="hobby[]"
  122. id="game"
  123. value="game"
  124. /><label></label>
  125. <input
  126. type="checkbox"
  127. name="hobby[]"
  128. id="shoot"
  129. value="shoot"
  130. /><label for="shoot">摄像</label>
  131. <input
  132. type="checkbox"
  133. name="hobby[]"
  134. id="programme"
  135. value="programme"
  136. checked
  137. /><lable for="programme">编程开发</label>
  138. </div>
  139. <div>
  140. <!-- 选项列表 -->
  141. <label for="brand">手机品牌</label>
  142. <input type="search" list="phone" name="brand" id="brand">
  143. <datalist id="phone">
  144. <option value="apple"> </option>
  145. <option value="huawei"> </option>
  146. <option value="xiaomi"> </option>
  147. <option value="lenove" label="小米"> </option>
  148. </datalist>
  149. </div>
  150. </fieldset>
  151. <fieldset>
  152. <legend>其它信息</legend>
  153. <div>
  154. <label for="file-id">文件上传</label>
  155. <input type="file" name="filename" id="file-id" accept="image/jpeg,image/jpg,image/png">
  156. </div>
  157. <div>
  158. <label for="area-id">备注</label>
  159. <textarea name="area" id="area-id" placeholder="请输入你的内容,100字内" cols="30" rows="10">
Correcting teacher:WJWJ

Correction status:qualified

Teacher's comments:总体写的不错,代码要贴全,合理使用注释!
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post