24大数据技术10.22实验课作业
注意
必须在学习通下载对应资源
点击代码块,可使用方向键左右移动查看代码
注释部分不需要敲
有以前的代码的话,第一个页面可只敲script部分
提交注册后跳转到另一个页面的截图,并在注册时用户名改为自己的名字,这样截图是也可以正确显示
1.resi.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
| <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="css/semantic.min.css"> <style>
* { padding: 0; margin: 0; box-sizing: border-box;
}
.bg { position: absolute; width: 100%; height: 100%; }
video { position: absolute; width: 100%; height: 100%; bottom: 0; right: 0; z-index: -1; object-fit: cover; }
.resi { position: absolute; width: 30%; height: 75% auto; background-color: rgba(0, 0, 0, 0.3); border-radius: 10%; left: 65%; top: 12.5%; padding: 20px; }
.resi-title { color: white; margin-bottom: 5px; font-size: 2em; font-family: 'PixelFont'; text-align: center; }
p, legend { color: white; margin-bottom: 15px; font-size: 1.5em; font-family: 'PixelFont'; text-align: center; }
label { display: block; color: white; margin-bottom: 10px; font-size: 1.2em; font-family: 'PixelFont'; text-align: left; }
input[type="checkbox"] { margin-top: 4px; }
.ui.form input[type="email"], .ui.form input[type="text"], .ui.form input[type="password"], .ui.form input[type="date"] { background-color: #f0e8ff !important; margin-bottom: 6px; }
input[list="software"] { background-color: #f0e8ff !important; }
select { background-color: #f0e8ff !important; }
.form-group { width: 100%; }
fieldset{ margin-bottom: 10px; padding: 10px; }
.button-group { display: flex; justify-content: center; gap: 15px; } footer { position: absolute; bottom: 10px; width: 100%; text-align: center; color: white; font-size: 14px; font-family: Arial; } </style> </head> <body> <div class="bg"> <video autoplay loop muted> <source src="video/jett.mp4" type="video/mp4"> </video> <div class="resi"> <h1 class="resi-title">注册</h1> <form class="form-group ui form"> <fieldset> <legend>个人资料</legend> <div> <label>电子邮箱:</label> <input type="email" placeholder="电子邮箱"> </div> <div> <label>用户名:</label> <input type="text" placeholder="用户名"> </div> <div> <label>密码:</label> <input type="password" placeholder="密码"> </div> <div> <label>出生日期:</label> <input type="date" placeholder="出生日期"> </div> <div> <p>兴趣爱好: <input class="ui checkbox" type="checkbox" name="fans" value="01"/>唱歌 <input class="ui checkbox" type="checkbox" name="fans" value="02"/>打球 <input class="ui checkbox" type="checkbox" name="fans" value="03"/>下棋 <input class="ui checkbox" type="checkbox" name="fans" value="04"/>上网 <input class="ui checkbox" type="checkbox" name="fans" value="05"/>购物 </p> </div> <p>性别:<input class="ui radio" type="radio" name="sex" value="男" checked />男 <input class="ui radio" type="radio" name="sex" value="女"/>女 </p> </fieldset> <fieldset> <legend>专业与课程</legend> <label for="">课程名:</label><select name="course"> <option>软件工程</option> <option>计算机应用</option> <option selected>大数据技术</option> <option>数据库应用基础</option> <option>C语言</option> <option>网页设计</option> </select> <label for="">工具软件:</label><input list="software"> <datalist id="software"> <option value="1">Kingsoft WPS</option> <option value="2">MS Office</option> <option value="3">Visio</option> <option value="4">ToDesk</option> <option value="5">腾讯会议</option> </datalist> </fieldset> <div class="button-group"> <input class="ui yellow basic button" type="submit" value="提交"/> <input class="ui inverted yellow button" type="reset" value="重填"/> <button class="ui inverted violet button" onclick=alert("用于执行客户端脚本。")>执行客户端脚本</button> </div> </form> </div> </div> <footer> © 2025 |(改为你的名字) </footer> </body> <script> function registerHandler() { var form = document.querySelector("form"); form.addEventListener("submit", function (event) { var emailEl = document.querySelector('input[type="email"]'); var email = ""; if (emailEl) { email = emailEl.value; } var usernameEl = document.querySelector('input[type="text"]'); var username = ""; if (usernameEl) { username = usernameEl.value; } var passwordEl = document.querySelector('input[type="password"]'); var password = ""; if (passwordEl) { password = passwordEl.value; } var birthEl = document.querySelector('input[type="date"]'); var birth = ""; if (birthEl) { birth = birthEl.value; } var hobbyNodes = document.querySelectorAll('input[name="fans"]:checked'); var hobbies = []; for (var i = 0; i < hobbyNodes.length; i++) { hobbies.push(hobbyNodes[i].value); } var sexNode = document.querySelector('input[name="sex"]:checked'); var sex = ""; if (sexNode) { sex = sexNode.value; } var courseNode = document.querySelector('select[name="course"]'); var course = ""; if (courseNode) { course = courseNode.value; } var toolNode = document.querySelector('input[list="software"]'); var tool = ""; if (toolNode) { tool = toolNode.value; } var data = { email: email, username: username, password: password, birth: birth, hobbies: hobbies, sex: sex, course: course, tool: tool }; localStorage.setItem("regData", JSON.stringify(data)); form.action = "profile.html"; }); } registerHandler(); </script>
</html>
|
2.profile.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
| <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <title>个人空间</title>
<link rel="stylesheet" href="css/semantic.min.css">
<style> body { background: url("video/autumn.png") no-repeat center center; background-size: cover; background-color: #000; color: #fff; font-family: "Helvetica Neue", Arial, sans-serif; padding: 32px; }
.wrap { max-width: 760px; margin: 0 auto; } .card.custom { background: rgba(20,60,20,0.5); color: #fff; padding: 20px; } .field-row { margin: 10px 0; display: flex; align-items: flex-start; } .label { width: 140px; color: #bdbdbd; flex-shrink: 0; } .value { color: #fff; word-break: break-word; white-space: pre-wrap; flex: 1; } .actions { margin-top: 18px; display: flex; gap: 10px; } </style> </head> <body> <div class="wrap"> <div class="ui centered card custom"> <div class="content"> <h2 class="ui header" style="color:#fff; text-align:center; margin:0 0 12px 0;"> 个人空间 — 注册信息展示 </h2>
<div id="infoArea"> <div class="field-row"><div class="label">电子邮箱:</div><div id="email" class="value">-</div></div> <div class="field-row"><div class="label">用户名:</div><div id="username" class="value">-</div></div> <div class="field-row"><div class="label">密码:</div><div id="password" class="value">-</div></div> <div class="field-row"><div class="label">出生日期:</div><div id="birth" class="value">-</div></div> <div class="field-row"><div class="label">性别:</div><div id="sex" class="value">-</div></div> <div class="field-row"><div class="label">兴趣爱好:</div><div id="hobbies" class="value">-</div></div> <div class="field-row"><div class="label">课程:</div><div id="course" class="value">-</div></div> <div class="field-row"><div class="label">工具软件:</div><div id="tool" class="value">-</div></div> </div>
<div class="actions"> <a class="ui yellow button" href="resi.html">返回修改</a> </div> </div> </div> </div>
<script> var raw = localStorage.getItem("regData");
function setText(id, text) { var el = document.getElementById(id); if (!el) return; if (text === null || text === undefined || text === "") { el.textContent = "-"; } else { el.textContent = String(text); } }
if (!raw) { var area = document.getElementById("infoArea"); area.innerHTML = "<p style='color:#ffb3b3;'>未找到注册数据,请先返回填写注册信息。</p>"; } else { var data = JSON.parse(raw);
setText("email", data.email); setText("username", data.username); setText("password", data.password); setText("birth", data.birth); setText("sex", data.sex);
if (data.hobbies && data.hobbies.length > 0) { setText("hobbies", data.hobbies.join("、")); } else { setText("hobbies", "-"); }
setText("course", data.course); setText("tool", data.tool); } </script> </body> </html>
|