博客列表 >1018作业:表单

1018作业:表单

PHP是世界上最好的语言
PHP是世界上最好的语言原创
2022年10月19日 14:13:06328浏览

立完成一个用户注册表单,至少用到5个以上的表单控件。

代码

  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. <style>
  9. form div {
  10. margin: 10px 0;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <div class="content" style="margin: 5px auto; width: 1000px;">
  16. <div class="main" style="margin: 0 auto; width: 800px;">
  17. <h2 class="title" style="text-align: center;">用户注册</h2>
  18. <form action="index.php" method="POST" enctype="multipart/form-data" target="_blank" id="register">
  19. <fieldset>
  20. <legend>账号信息</legend>
  21. <div class="username">
  22. <label for="username">账号名称</label>
  23. <input id="username" type="text" name="username" placeholder="请输入用户名" required>
  24. </div>
  25. <div class="password">
  26. <label for="password">用户密码</label>
  27. <input id="password" type="password" name="password" value="123" placeholder="请输入密码" required>
  28. </br>
  29. <progress name="safe" max="10" min="0" value="3"></progress>
  30. <output>密码安全程度:<span style="color: red;">较弱</span></output>
  31. </div>
  32. <div class="repassword">
  33. <label for="repassword">确认密码</label>
  34. <input id="repassword" type="password" name="repassword" value="123" placeholder="请确认密码" required>
  35. </div>
  36. <div class="upload" style="margin: 10px 0;">
  37. <label for="upload">头像</label>
  38. <input id="upload" type="file" name="upload">
  39. <button type="button">上传</button>
  40. </div>
  41. </fieldset>
  42. <fieldset>
  43. <legend>用户信息</legend>
  44. <div class="gender">
  45. <label for="secret">性别:</label>
  46. <input type="radio" name="gender" value="male" id="male"><label for="male"></label>
  47. <input type="radio" name="gender" value="female" id="female" ><label for="female"></label>
  48. <input type="radio" name="gender" value="secret" id="secret" checked><label for="secret">保密</label>
  49. </div>
  50. <div class="birthday">
  51. <label for="birthday">生日:</label>
  52. <input type="date" name="birthday" value="2022-10-18" id="birthday" min="1949-10-01" max="2000-01-01" />
  53. </div>
  54. <div class="phone">
  55. <label for="phone">手机号</label>
  56. <select name="phone" id="edu" form="">
  57. <option value="0" selected>+86</option>
  58. <optgroup label="美洲">
  59. <option value="1">+90</option>
  60. <option value="2">+99</option>
  61. <option value="3">+88</option>
  62. </optgroup>
  63. <optgroup label="欧洲">
  64. <option value="4">+10</option>
  65. <option value="5">+68</option>
  66. </optgroup>
  67. </select>
  68. <input id="phone" type="number" placeholder="请输入手机号">
  69. </div>
  70. <div class="email">
  71. <label for="email">邮箱</label>
  72. <input id="email" type="email" name="email" placeholder="user@php.cn" required>
  73. </div>
  74. <div class="color">
  75. <label for="color">喜欢的颜色</label>
  76. <input id="color" type="color" name="color" value="#FFFF00">
  77. </div>
  78. <div class="like">
  79. <label for="keyword">想要学习的语言</label>
  80. <input type="search" name="language" list="details" id="keyword">
  81. <datalist id="details">
  82. <option value="Java">Java</option>
  83. <option value="C++">C++</option>
  84. <option value="Go">Go</option>
  85. <option value="Python">Python</option>
  86. <option value="Js">Js</option>
  87. </datalist>
  88. </div>
  89. <div>
  90. <label for="comment">个人简介</label>
  91. <textarea placeholder="介绍自己,让别人更好地认识你,800字以内。" name="comment" id="comment" cols="30" rows="5" maxlength="200" style="resize: none"></textarea>
  92. </div>
  93. </fieldset>
  94. <div class="agree">
  95. <input type="checkbox" name="agree" value="agree" id="agree" checked><label for="program">已经阅读并同意</label><a style="text-decoration: none" href="http://www.baidu.com"><span style="color: red;">用户服务协议</span></a>
  96. </div>
  97. <div class="agree">
  98. <input type="checkbox" name="agree" value="agree" id="agree" checked><label for="program">允许向我的邮箱发送邮件</label>
  99. </div>
  100. <div style="text-align:center">
  101. <button type="button" style="display: inline-block; margin: 15px; height: 40px; width: 80px;">重置</button>
  102. <button type="button" style="display: inline-block; margin: 15px; height: 40px; width: 80px;">确认注册</button>
  103. </div>
  104. </form>
  105. </div>
  106. </div>
  107. </body>
  108. </html>

效果

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议