博客列表 >表格与表单基础

表格与表单基础

alex
alex原创
2023年02月03日 09:03:47316浏览

写一个课程表, 要求用到行与列的合并

运行效果

  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>Document</title>
  8. </head>
  9. <body>
  10. <table border="1" width="400">
  11. <caption>课程表</caption>
  12. <thead>
  13. <tr>
  14. <!-- <th></th> -->
  15. <th colspan="2">上课安排</th>
  16. <th>星期一</th>
  17. <th>星期二</th>
  18. <th>星期三</th>
  19. <th>星期四</th>
  20. <th>星期五</th>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. <tr>
  25. <td rowspan="4">上午</td>
  26. <td>第一节</td>
  27. <td>语文</td>
  28. <td >数学</td>
  29. <td>语文</td>
  30. <td>英语</td>
  31. <td>品德</td>
  32. </tr>
  33. <tr>
  34. <!-- <td></td> -->
  35. <td>第二节</td>
  36. <td>英语</td>
  37. <td>语文</td>
  38. <td>数学</td>
  39. <td>社会</td>
  40. <td>美术</td>
  41. </tr>
  42. <tr>
  43. <!-- <td></td> -->
  44. <td>第三节</td>
  45. <td>微机</td>
  46. <td>英语</td>
  47. <td>阅读</td>
  48. <td>语文</td>
  49. <td>语文</td>
  50. </tr>
  51. <tr>
  52. <!-- <td></td> -->
  53. <td>第四节</td>
  54. <td>数学</td>
  55. <td>美术</td>
  56. <td>英语</td>
  57. <td>微机</td>
  58. <td>数学</td>
  59. </tr>
  60. <tr>
  61. <td rowspan="3">下午</td>
  62. <td>第五节</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>第六节</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>第七节</td>
  81. <td>自习</td>
  82. <td>社会</td>
  83. <td></td>
  84. <td>自然</td>
  85. <td></td>
  86. </tr>
  87. </tbody>
  88. </table>
  89. </body>
  90. </html>

写一个注册表单,尽量用到课堂上提及的所有控件

运行效果

  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. </head>
  9. <body>
  10. <form action="signup.php" method="post">
  11. <fieldset style="display: inline-grid;gap:1em">
  12. <legend>用户注册</legend>
  13. <div class="user">
  14. <label for="user">用户名:</label>
  15. <input type="text" id="user" name="user" placeholder="请输入用户名" required autofocus>
  16. </div>
  17. <div class="pwd">
  18. <label for="">密码:</label>
  19. <input type="text" id="pwd" name="pwd" placeholder="******" required>
  20. </div>
  21. <div class="pwd">
  22. <label for="">确认密码:</label>
  23. <input type="text" id="re_pwd" name="re_pwd" placeholder="******" required>
  24. </div>
  25. <div class="my_email">
  26. <label for="email">邮箱:</label>
  27. <input type="email" name="my_email" id="email" placeholder="12345@qq.com" required>
  28. </div>
  29. <div class="age">
  30. <label for="age">年龄:</label>
  31. <input type="number" min="18" max="99" id="age" value="18" step="5">
  32. </div>
  33. <div class="birth">
  34. <label for="birthday">生日:</label>
  35. <input type="date" name="hobby[]" id="birthday" value="1990-12-01" min="1949-01-01" max="2003-12-31">
  36. </div>
  37. <div class="search">
  38. <label for="">搜索:</label>
  39. <input type="search" name="keywords" id="search" placeholder="输入关键字">
  40. </div>
  41. <div class="upload">
  42. <label for="upload">上传头像:</label>
  43. <input type="file" name="user_pic" id="upload" accept="image/jpeg,image/png">
  44. <button type="button" onclick="fileUploads(this.form)">上传</button>
  45. </div>
  46. <!-- 单选按钮 -->
  47. <div class="gender">
  48. <label for="male">性别:</label>
  49. <input type="radio" name="gender" id="male" checked><label for="male"></label>
  50. <input type="radio" name="gender" id="female"><label for="female"></label>
  51. <input type="radio" name="gender" id="un"><label for="un">保密</label>
  52. </div>
  53. <!-- 多选 -->
  54. <div class="hobby">
  55. <label >爱好:</label>
  56. <input type="checkbox" name="hobby[]" id="game" checked><label for="game">游戏</label>
  57. <input type="checkbox" name="hobby[]" id="travel"><label for="travel">旅游</label>
  58. <input type="checkbox" name="hobby[]" id="shoot"><label for="shoot">摄影</label>
  59. <input type="checkbox" name="hobby[]" id="code" checked><label for="code">编程</label>
  60. </div>
  61. <div class="edu">
  62. <select name="edu" id="edu">
  63. <option value="" selected disabled>请选择</option>
  64. <option value="1">高中及以下</option>
  65. <option value="2">专科</option>
  66. <option value="3">本科</option>
  67. <option value="4">硕士</option>
  68. <option value="5">博士及以上</option>
  69. </select>
  70. </div>
  71. <button>提交</button>
  72. </fieldset>
  73. </form>
  74. </body>
  75. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议