Blogger Information
Blog 6
fans 0
comment 0
visits 5949
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
列表,表格,表单与框架
好好学习
Original
781 people have browsed it

表格总结

标签名 说明
<table> 定义一个表格
<caption> 表示表格的标题
<thead> 表示表格表头
<tbody> 表示表格主体
<tr> 定义表格行
<td> 定义表格中的单元格
<th> 用于表格的第一行或者第一列 且文本会加粗并居中显示
border 表示表格的边框
cellspacing 表示单元格与单元格之间的距离
cellpadding 表示单元格内容与单元格边框之间的距离
rowspan 跨行合并 rowspan=“合并单元格个数”
colspan 跨列合并 colspan=“合并单元格个数”

1、利用表格制作一个课程表

代码

  1. <!-- 用table定义表格 -->
  2. <table border="1" cellspacing="0" cellpadding="10">
  3. <caption>
  4. 五行课程表
  5. </caption>
  6. <thead>
  7. <tr>
  8. <th colspan="2"></th>
  9. <th>星期一</th>
  10. <th>星期二</th>
  11. <th>星期三</th>
  12. <th>星期四</th>
  13. <th>星期五</th>
  14. </tr>
  15. </thead>
  16. <!-- 表格主体 -->
  17. <tbody>
  18. <tr>
  19. <td rowspan="4">上午</td>
  20. <td>1</td>
  21. <td>语文</td>
  22. <td>语文</td>
  23. <td>语文</td>
  24. <td>语文</td>
  25. <td>语文</td>
  26. </tr>
  27. <tr>
  28. <td>2</td>
  29. <td>英语</td>
  30. <td>英语</td>
  31. <td>英语</td>
  32. <td>英语</td>
  33. <td>英语</td>
  34. </tr>
  35. <tr>
  36. <td>3</td>
  37. <td>化学</td>
  38. <td>化学</td>
  39. <td>化学</td>
  40. <td>化学</td>
  41. <td>化学</td>
  42. </tr>
  43. <tr>
  44. <td>4</td>
  45. <td>历史</td>
  46. <td>历史</td>
  47. <td>历史</td>
  48. <td>历史</td>
  49. <td>历史</td>
  50. </tr>
  51. <tr>
  52. <th colspan="7">休息时间</th>
  53. </tr>
  54. <tr>
  55. <td rowspan="3">下午</td>
  56. <td>5</td>
  57. <td>体育</td>
  58. <td>体育</td>
  59. <td>体育</td>
  60. <td>体育</td>
  61. <td>体育</td>
  62. </tr>
  63. <tr>
  64. <td>6</td>
  65. <td>化学</td>
  66. <td>化学</td>
  67. <td>化学</td>
  68. <td>化学</td>
  69. <td>化学</td>
  70. </tr>
  71. <tr>
  72. <td>7</td>
  73. <td>自习</td>
  74. <td>自习</td>
  75. <td>自习</td>
  76. <td>自习</td>
  77. <td>自习</td>
  78. </tr>
  79. </tbody>
  80. </table>

2、表单控件

  1. <form>
  2. <!-- 文本输入框 -->
  3. <label for="number">账号</label>
  4. <input type="text" id="number" name="number" value="number" placeholder="输入账号" />
  5. <p></p>
  6. <!-- 密码输入框 -->
  7. <label for="password">密码</label>
  8. <input type="password" id="password" name="password" value="password" placeholder="输入密码"/>
  9. <p></p>
  10. <!-- 邮箱输入框 -->
  11. <label for="email"> 邮箱</label>
  12. <input type="email" id="email" name="email" value="email" placeholder="admin@admin.com" />
  13. <p></p>
  14. <!-- 复选框 -->
  15. <label for="">爱好</label>
  16. <input type="checkbox" name="hobbey[]" id="chi" value="chi"" checked/> <label for="chi"></label>
  17. <input type="checkbox" name="hobbey[]" id="he"" value="he" /> <label for="he"></label>
  18. <input type="checkbox" name="hobbey[]" id="wan" value="wan" checked /> <label for="wan"></label>
  19. <input type="checkbox" name="hobbey[]" id="le" value="le" /> <label for="le"></label>
  20. <p></p>
  21. <!-- 单选框 -->
  22. <label for="">性别</label>
  23. <input type="radio" name="sex" id="nan" value="nan" checked/> <label for="nan"></label>
  24. <input type="radio" name="sex" id="nv" value="nv" /> <label for="nv"></label>
  25. <p></p>
  26. <!-- 下拉列表 -->
  27. <label for="edu">学历</label>
  28. <select name="edu" id="edu">
  29. <option value="1">小学</option>
  30. <option value="2">初中</option>
  31. <option value="3">高中</option>
  32. </select>
  33. <p></p>
  34. <!-- 文件域 -->
  35. <label for="uesr-pic">头像</label>
  36. <input type="hidden" name="MAX_FILE_SIZE" value="80000"> <!-- 隐藏域,在后端处理使用 -->
  37. <input type="file" name="uesr_pic" >
  38. <p></p>
  39. <!-- 文本域 -->
  40. <label for="comment">备注:</label>
  41. <textarea name="comment" id="comment" cols="30" rows="10" ></textarea>
  42. <p></p>
  43. <!-- 提交 -->
  44. <button>提交</button>
  45. </form>

关于表单

属性 属性值及说明 说明
type text 定义文本输入
type password 定义密码输入
type email 定义邮箱输入
type checkbox 复选框
type radio 单选框
type file 文件域
type hidden 标签将隐藏

1 通过修改type属性值,来定义input表单类型
2 name属性用于对提交到服务器后的表单数据进行标识
3 复选框的name属性值应该写与数组的格式名称,这样才确保服务器可以接收到一组值
4 required属性规定必需在提交之前填写输入字段
5 placeholder属性 为空时显示,提示信息,

关于文本域

  1. <textarea>
  2. 文本内容
  3. </textarea>

关于下拉列表

  1. <select>
  2. <option>选项1</option>
  3. <option>选项2</option>
  4. <option>选项3</option>
  5. </select>

from表单域

  1. <form action="提交地址" method="提交方式" name="表单名称">
  2. 表单控件
  3. </form>

1 提交方式分为GET和POST ,GET:数据直接放在url地址中,POST:表单的数据在请头体中

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!