Blogger Information
Blog 15
fans 0
comment 0
visits 9217
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1209列表\表格\表单
fanyigle_php
Original
1530 people have browsed it

1.列表
列表的主要作用是用来做容器,装其他标签内容;
一个标签不够需要其他标签来帮忙的,引申复合标签配套使用;
2.表格
表格由表头\表身\表尾组成;
每一行都是tr打头,td/th是单元格装东西;
表格支持横纵合并;
3.表单
表单的任务是收集用户数据;
概况起来说,用户需要看到有意义的提示,然后输入合法的信息;
form 是大哥,小弟都进来;大哥把数据打包决定以post还是get的方式把数据发给服务器的某某某;小弟的身份以name区分,小弟要说啥用value表示;在用户这边小弟以type=xxx显得不同
label标签一是可以用文本提示用户要输入什么,二是可以做个id简单跳转;
input是输入控件,完成实际采集工作,文本类就是text\password\email,
单选radio多选checkbox,多选时name要用数组来收集
列表select+option
隐藏域hidden悄悄给服务器传递信息;
文件域file的特别之处是form的method要为post,enctype也要选带form的;

form表单和输入控件也可以通过控件的form属性指向表单的id以实现关联。

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>课程表练习</title>
  7. <style>
  8. table,
  9. th,
  10. td {
  11. border: 1px solid black;
  12. border-collapse: collapse;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <!-- 1.列表练习 -->
  18. <ul>
  19. <li>苹果</li>
  20. <li>香蕉</li>
  21. <li>菠萝</li>
  22. </ul>
  23. <ol>
  24. <li>先学HTML</li>
  25. <li>再学CSS</li>
  26. <li>最后学PHP</li>
  27. </ol>
  28. <dl>
  29. <dt>地址</dt>
  30. <dd>光明村88号</dd>
  31. <dt>电话</dt>
  32. <dd>12316</dd>
  33. </dl>
  34. <!-- 2.表格练习:课程表 -->
  35. <table>
  36. <caption>
  37. 我的课程表
  38. </caption>
  39. <thead>
  40. <tr>
  41. <td>时间</td>
  42. <td>序号</td>
  43. <td>星期一</td>
  44. <td>星期二</td>
  45. <td>星期三</td>
  46. <td>星期四</td>
  47. <td>星期五</td>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <tr>
  52. <td rowspan="4">上午</td>
  53. <td>1</td>
  54. <td>语文</td>
  55. <td>数学</td>
  56. <td>英语</td>
  57. <td>化学</td>
  58. <td>地理</td>
  59. </tr>
  60. <tr>
  61. <!-- <td></td> -->
  62. <td>2</td>
  63. <td>语文</td>
  64. <td>数学</td>
  65. <td>英语</td>
  66. <td>化学</td>
  67. <td>地理</td>
  68. </tr>
  69. <tr>
  70. <!-- <td></td> -->
  71. <td>3</td>
  72. <td>语文</td>
  73. <td>数学</td>
  74. <td>英语</td>
  75. <td>化学</td>
  76. <td>地理</td>
  77. </tr>
  78. <tr>
  79. <!-- <td></td> -->
  80. <td>4</td>
  81. <td>语文</td>
  82. <td>数学</td>
  83. <td>英语</td>
  84. <td>化学</td>
  85. <td>地理</td>
  86. </tr>
  87. <tr>
  88. <td colspan="7" style="text-align: center">中午休息</td>
  89. </tr>
  90. <tr>
  91. <td rowspan="3">下午</td>
  92. <td>1</td>
  93. <td>语文</td>
  94. <td>数学</td>
  95. <td>英语</td>
  96. <td>化学</td>
  97. <td rowspan="3">课外活动</td>
  98. </tr>
  99. <tr>
  100. <!-- <td></td> -->
  101. <td>2</td>
  102. <td>语文</td>
  103. <td>数学</td>
  104. <td>英语</td>
  105. <td>化学</td>
  106. <!-- <td>地理</td> -->
  107. </tr>
  108. <tr>
  109. <!-- <td></td> -->
  110. <td>3</td>
  111. <td>语文</td>
  112. <td>数学</td>
  113. <td>英语</td>
  114. <td>化学</td>
  115. <!-- <td>地理</td> -->
  116. </tr>
  117. </tbody>
  118. </table>
  119. <!-- 3.表单填写 -->
  120. <h3>用户注册</h3>
  121. <form action="" method="POST" enctype="multipart/form-data">
  122. <!-- 单行文本框输入 -->
  123. <label for="username">用户名:</label>
  124. <input
  125. type="text"
  126. name="username"
  127. value=""
  128. id="username"
  129. placeholder="请输入用户名"
  130. required
  131. />
  132. <br />
  133. <label for="password">密码:</label>
  134. <input
  135. type="password"
  136. name="password"
  137. value=""
  138. id="password"
  139. placeholder="请输入密码"
  140. required
  141. />
  142. <br />
  143. <label for="email">邮箱:</label>
  144. <input
  145. type="email"
  146. name="email"
  147. value=""
  148. id="email"
  149. placeholder="abc@qq.com"
  150. required
  151. />
  152. <!-- 单选和复选框 -->
  153. <div>
  154. <label for="secret">性别:</label>
  155. <input type="radio" name="sex" value="男" id="male" /><label for="male"
  156. ></label
  157. >
  158. <input type="radio" name="sex" value="女" id="female" /><label
  159. for="female"
  160. ></label
  161. >
  162. <input type="radio" name="sex" value="保密" id="secret" checked /><label
  163. for="secret"
  164. >保密</label
  165. >
  166. </div>
  167. <div>
  168. <label for="">爱好:</label>
  169. <input
  170. type="checkbox"
  171. name="hobby[]"
  172. value="program"
  173. id="program"
  174. /><label for="program">编程</label>
  175. <input type="checkbox" name="hobby[]" value="sleep" id="sleep" /><label
  176. for="sleep"
  177. >睡觉</label
  178. ><input type="checkbox" name="hobby[]" value="majo" id="majo" /><label
  179. for="majo"
  180. >打麻将</label
  181. >
  182. </div>
  183. <!-- 下拉列表 -->
  184. <label for="edu">学历:</label>
  185. <select name="edu" id="edu" multiple size="3">
  186. <option value="1">初中</option>
  187. <option value="2">高中</option>
  188. <option value="3" label="大学1">大学</option>
  189. </select>
  190. <!-- 文件域/隐藏域 -->
  191. <br />
  192. <input type="hidden" name="filesize" value="300000" />
  193. <input type="file" name="fileselect" id="fileselect" />
  194. <!-- 文本域 -->
  195. <div>
  196. <label for="explain">说明</label>
  197. <textarea
  198. name="explain"
  199. id="explain"
  200. cols="20"
  201. rows="3"
  202. placeholder="内容不超过60个字"
  203. ></textarea>
  204. </div>
  205. <button>提交</button>
  206. </form>
  207. </body>
  208. </html>
Correcting teacher:天蓬老师天蓬老师

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