蛋学传教组织查分系统 - 查询你的笔试和面试分数
<!DOCTYPE html>
<html>
<head>
<title>蛋学传教组织查分系统</title>
<style>
body {
background-color: #FFEFD5;
font-family: Arial, sans-serif;
}
h1 {
text-align: center;
}
input[type="text"] {
padding: 5px;
font-size: 16px;
border-radius: 5px;
border: none;
box-shadow: 0px 1px 5px grey;
margin: 20px auto;
display: block;
width: 300px;
}
button {
background-color: #FF8C00;
color: white;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
box-shadow: 0px 1px 5px grey;
display: block;
margin: 0px auto;
cursor: pointer;
}
table {
margin: 20px auto;
border-collapse: collapse;
width: 400px;
}
td, th {
padding: 10px;
border: 1px solid black;
text-align: center;
}
.error {
color: red;
margin: 20px auto;
text-align: center;
}
</style>
<script>
function animateEgg() {
var egg = document.getElementById('egg');
var count = 0;
var interval = setInterval(function() {
count++;
if (count == 10) {
clearInterval(interval);
egg.style.display = 'none';
document.getElementById('page').style.display = 'block';
} else {
egg.style.width = 100 + count * 10 + 'px';
egg.style.height = 125 + count * 10 + 'px';
}
}, 100);
}
</script>
</head>
<body onload="animateEgg()">
<div id="egg" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
<img src="https://cdn.pixabay.com/photo/2017/02/28/12/51/egg-2105433_960_720.png">
</div>
<div id="page" style="display: none;">
<h1>蛋学传教组织查分系统</h1>
<input type="text" id="nameInput" placeholder="请输入姓名">
<button onclick="showScore()">查询</button>
<div id="scoreTable" style="display: none;">
<table>
<tr>
<th>姓名</th>
<th>笔试分数</th>
<th>面试分数</th>
</tr>
<tr>
<td id="name"></td>
<td id="writtenScore"></td>
<td id="interviewScore"></td>
</tr>
</table>
</div>
<div id="errorMessage" class="error" style="display: none;"></div>
</div>
<script>
function showScore() {
var name = document.getElementById('nameInput').value;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var data = xhr.responseText.split("\n");
for (var i = 1; i < data.length; i++) {
var row = data[i].split(',');
if (row[0] == name) {
document.getElementById('name').innerHTML = row[0];
document.getElementById('writtenScore').innerHTML = row[1];
document.getElementById('interviewScore').innerHTML = row[2];
document.getElementById('scoreTable').style.display = 'block';
document.getElementById('errorMessage').style.display = 'none';
return;
}
}
document.getElementById('errorMessage').innerHTML = '没有学生:' + name;
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('scoreTable').style.display = 'none';
}
};
xhr.open('GET', '分数.csv', true);
xhr.send();
}
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/oqo3 著作权归作者所有。请勿转载和采集!