博客列表 >课程表与注册表单

课程表与注册表单

P粉890456325
P粉890456325原创
2023年01月18日 14:25:47280浏览

0116作业

  1. 写一个课程表, 要求用到行与列的合并 2. 写一个注册表单,尽量用到课堂上提及的所有控件

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

    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>表格与表单</title>
    8. </head>
    9. <body>
    10. <!-- table>caption{课程表}+thead>tr>th{x}*7+tbody>tr*7>td{x}*7 -->
    11. <table border="1" width="350">
    12. <caption>课程表</caption>
    13. <thead>
    14. <tr>
    15. <th colspan="2"><br /></th>
    16. <!-- <th>x</th> -->
    17. <th>周一</th>
    18. <th>周二</th>
    19. <th>周三</th>
    20. <th>周四</th>
    21. <th>周五</th>
    22. <tbody>
    23. <tr>
    24. <td rowspan="4"><br /></td>
    25. <td>1</td>
    26. <td>语文</td>
    27. <td>数学</td>
    28. <td>体育</td>
    29. <td>英语</td>
    30. <td>自然</td>
    31. </tr>
    32. <tr>
    33. <!-- <td>x</td> -->
    34. <td>2</td>
    35. <td>语文</td>
    36. <td>数学</td>
    37. <td>体育</td>
    38. <td>英语</td>
    39. <td>自然</td>
    40. </tr>
    41. <tr>
    42. <!-- <td>x</td> -->
    43. <td>3</td>
    44. <td>语文</td>
    45. <td>数学</td>
    46. <td>体育</td>
    47. <td>英语</td>
    48. <td>自然</td>
    49. </tr>
    50. <tr>
    51. <!-- <td>x</td> -->
    52. <td>4</td>
    53. <td>语文</td>
    54. <td>数学</td>
    55. <td>体育</td>
    56. <td>英语</td>
    57. <td>自然</td>
    58. </tr>
    59. <tr>
    60. <td colspan="7"><br /></td>
    61. <!-- <td>x</td>
    62. <td>x</td>
    63. <td>x</td>
    64. <td>x</td>
    65. <td>x</td>
    66. <td>x</td> -->
    67. </tr>
    68. <tr>
    69. <td rowspan="2"><br /></td>
    70. <td>5</td>
    71. <td>语文</td>
    72. <td>数学</td>
    73. <td>体育</td>
    74. <td>英语</td>
    75. <td>自然</td>
    76. </tr>
    77. <tr>
    78. <!-- <td>x</td> -->
    79. <td>6</td>
    80. <td>语文</td>
    81. <td>数学</td>
    82. <td>体育</td>
    83. <td>英语</td>
    84. <td>自然</td>
    85. </tr>
    86. </tbody>
    87. </tr>
    88. </thead>
    89. </table>
    90. </body>
    91. </html>
  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="login.php" method="post">
  11. <fieldset style="display: inline-grid; gap: 1em;">
  12. <legend>用户注册</legend>
  13. <div class="username">
  14. <label for="uname">用户名:</label>
  15. <input type="text" name="username" placeholder="username" id="uname" autofocus />
  16. </div>
  17. <div class="my-email">
  18. <label for="my-email">邮箱:</label>
  19. <input type="email" name="my_email" id="my-email" placeholder="username@email.com" required autofocus />
  20. </div>
  21. <div class="psw">
  22. <label for="psw">密码:</label>
  23. <input type="password" name="password" id="psw" placeholder="******" required onkeydown="this.nextElementSibling.disabled=false"/>
  24. <button type="button" disabled onclick="showPsw(this,this.form)">显示</button>
  25. </div>
  26. <div class="age">
  27. <label for="age">年龄:</label>
  28. <input type="number" name="age" id="age" value="20" min="20" max="70" step="5">
  29. </div>
  30. <div class="birthday">
  31. <label for="birthday">生日:</label>
  32. <input type="date" name="birthday" id="birthday" value="2023-01-17" min="1900-01-01" max="2060-01-01" />
  33. </div>
  34. <div class="url">
  35. <label for="blog">博客:</label>
  36. <input type="url" name="url" id="blog" placeholder="http://" />
  37. </div>
  38. <div class="color">
  39. <label for="color">背景:</label>
  40. <input type="color" name="bgcolor" id="color" value="#ffff00" onchange="setBgColor(this,this.form)" />
  41. </div>
  42. <div class="search">
  43. <label for="keywords">搜索:</label>
  44. <input type="search" name="keywords" id="search" placeholder="输入关键字" />
  45. </div>
  46. <div class="upload">
  47. <label for="upload">头像:</label>
  48. <input type="file" name="user_pic" id="upload" accept="image/jpeg,image/png" />
  49. <button type="button" onclick="fileUploads(this.form)">上传</button>
  50. </div>
  51. <div class="gender">
  52. <label for="secret">性别:</label>
  53. <input type="radio" name="gender" value="male" id="male" /><label for="male"></label>
  54. <input type="radio" name="gender" value="female" id="female" /><label for="female"></label>
  55. <input type="radio" name="gender" value="secret" id="secret" checked /><label for="secret">保密</label>
  56. </div>
  57. <div class="hobby">
  58. <label>爱好:</label>
  59. <input type="checkbox" name="hobby[]" value="game" id="game" checked /><label for="game">五子棋</label>
  60. <input type="checkbox" name="hobby[]" value="trave" id="trave" /><label for="trave">围棋</label>
  61. <input type="checkbox" name="hobby[]" value="shoot" id="shoot" /><label for="shoot">象棋</label>
  62. <input type="checkbox" name="hobby[]" value="program" id="program" checked /><label for="program">编程</label>
  63. </div>
  64. <button type="submit">注册</button>
  65. </fieldset>
  66. </form>
  67. <script>
  68. function showPsw(ele, form) {
  69. const psw = form.password
  70. if (psw.type === 'password') {
  71. psw.type = 'text'
  72. ele.textContent = '隐藏'
  73. } else if (psw.type === 'text') {
  74. psw.type = 'password'
  75. ele.textContent = '显示'
  76. } else {
  77. return false
  78. }
  79. }
  80. function setBgColor(ele, form) {
  81. form.firstElementChild.style.backgroundColor = ele.value
  82. }
  83. function fileUploads(form) {
  84. let tips = ''
  85. if (form.user_pic.value.length === 0) {
  86. tips += '文件不能为空'
  87. } else {
  88. tips += '上传成功'
  89. }
  90. alert(tips)
  91. }
  92. </script>
  93. </body>
  94. </html>

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