博客列表 >表格与表单的实际运用

表格与表单的实际运用

风残念北的博客
风残念北的博客原创
2023年02月04日 01:49:35323浏览

1.课程表

1.1知识点

运用tr,th,td标签。合并列:rowspan="3"意思为合并三列;合并行:colspan="2"意思为合并两行。

1.2运行截图

PHP中文网课程表

1.3代码演示

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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>PHP中文网课程表</title>
  8. </head>
  9. <body>
  10. <table border="1" width="600">
  11. <caption>
  12. <h1>PHP中文网课程表</h1>
  13. </caption>
  14. <tr>
  15. <th colspan="2">课程\星期</th>
  16. <th>星期一</th>
  17. <th>星期二</th>
  18. <th>星期三</th>
  19. <th>星期四</th>
  20. <th>星期五</th>
  21. <th>星期六</th>
  22. <th>星期天</th>
  23. </tr>
  24. <tr>
  25. <th rowspan="3">上午</th>
  26. <th>第一节</th>
  27. <td>HTML</td>
  28. <td>JS</td>
  29. <td>CSS</td>
  30. <td>VUE</td>
  31. <td>PHP</td>
  32. <th rowspan="3" colspan="2">休息</th>
  33. </tr>
  34. <tr>
  35. <th>第二节</th>
  36. <td>HTML</td>
  37. <td>JS</td>
  38. <td>JS</td>
  39. <td>PHP</td>
  40. <td>CSS</td>
  41. </tr>
  42. <tr>
  43. <th>第三节</th>
  44. <td>CSS</td>
  45. <td>JS</td>
  46. <td>PHP</td>
  47. <td>VUE</td>
  48. <td>PHP</td>
  49. </tr>
  50. <tr>
  51. <th colspan="9">午休</th>
  52. </tr>
  53. <tr>
  54. <th rowspan="3">下午</th>
  55. <th>第四节</th>
  56. <td>Markdown</td>
  57. <td>综合实战</td>
  58. <td>JS</td>
  59. <td>综合实战</td>
  60. <td>VUE</td>
  61. <th rowspan="3" colspan="2">休息</th>
  62. </tr>
  63. <tr>
  64. <th>第五节</th>
  65. <td>Markdown</td>
  66. <td>PHP</td>
  67. <td>JS</td>
  68. <td>VUE</td>
  69. <td>CSS</td>
  70. </tr>
  71. <tr>
  72. <th>第六节</th>
  73. <td>综合实战</td>
  74. <td>Markdown</td>
  75. <td>VUE</td>
  76. <td>PHP</td>
  77. <td>JS</td>
  78. </tr>
  79. </table>
  80. </body>
  81. </html>

2.注册表单

2.1运行截图

PHP中文网用户注册

2.2代码演示

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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>Document</title>
  8. </head>
  9. <body>
  10. <form action="register.php" method="post">
  11. <fieldset style="display: inline-grid; gap: 1em;">
  12. <legend>用户注册</legend>
  13. <div class="username">
  14. <label for="username">用户名:</label>
  15. <input type="text" name="username" placeholder="username" id="username" required autofocus>
  16. </div>
  17. <div class="my-email">
  18. <label for="email">邮箱:</label>
  19. <input type="email" name="email" placeholder="admin@eamil.com" id="email">
  20. </div>
  21. <div class="psw">
  22. <label for="password">密码:</label>
  23. <input type="password" name="password" placeholder="******" id="password" required>
  24. <button type="button" disabled>显示</button>
  25. </div>
  26. <div class="age">
  27. <label for="age">年龄:</label>
  28. <input type="number" name="age" id="age" value="18" max="50" min="18">
  29. </div>
  30. <div class="birthday">
  31. <label for="birth">出生日期:</label>
  32. <input type="date" name="birthday" id="birth" value="2002-11-02" max="2005-02-04" min="1973-02-04" >
  33. </div>
  34. <div class="color">
  35. <label for="color">喜欢的颜色:</label>
  36. <input type="color" name="color" id="color">
  37. </div>
  38. <div class="blog">
  39. <label for="blog">博客地址:</label>
  40. <input type="url" name="blog" id="blog" placeholder="https://qq-xb.cn/">
  41. </div>
  42. <div class="upload">
  43. <label for="upload">头像上传:</label>
  44. <input type="file" name="upload" id="upload">
  45. <button type="button">上传</button>
  46. </div>
  47. <div class="gender">
  48. <label for="unknow">性别:</label>
  49. <input type="radio" name="gender" value="boy" id="boy"><label for="boy"></label>
  50. <input type="radio" name="gender" value="girl" id="girl"><label for="girl"></label>
  51. <input type="radio" name="gender" value="unknow" id="unknow" checked><label for="unknow">未知</label>
  52. </div>
  53. <div class="hobby">
  54. <label for="">兴趣:</label>
  55. <input type="checkbox" name="hobby[]" value="program" id="program"><label for="program">编程</label>
  56. <input type="checkbox" name="hobby[]" value="game" id="game"><label for="game">游戏</label>
  57. </div>
  58. <div class="edu">
  59. <label for="">文化水平:</label>
  60. <select name="edu" id="edu">
  61. <option value="" disabled selected>请选择</option>
  62. <option value="">本科</option>
  63. </select>
  64. </div>
  65. <button>注册</button>
  66. </fieldset>
  67. </form>
  68. </body>
  69. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议