body {
fontfamily: Arial, sansserif;
margin: 0;
padding: 20px;
}
h1 {
textalign: center;
marginbottom: 30px;
}
p {
lineheight: 1.5;
}
.queryform {
marginbottom: 50px;
}
label {
display: block;
marginbottom: 10px;
}
input[type="text"], textarea {
width: 100%;
padding: 10px;
marginbottom: 15px;
}
button {
padding: 10px 20px;
backgroundcolor: 007BFF;
color: white;
border: none;
cursor: pointer;
}
.result {
border: 1px solid ccc;
padding: 20px;
margintop: 30px;
backgroundcolor: f9f9f9;
}
// 假设我们有一个成绩数据的模拟
const scores = [
{
name: '张三',
date: '20220315',
score: 85,
subject: '大连话基础'
},
// 增加更多成绩数据...
];
document.getElementById('queryform').addEventListener('submit', async (e) => {
e.preventDefault();
const name = document.getElementById('name').value;
const date = document.getElementById('testdate').value;
const matchingScore = scores.find(score => score.name === name && score.date === date);
if (matchingScore) {
document.getElementById('resultcontent').innerHTML = `
姓名:${matchingScore.name}
考试日期:${matchingScore.date}
大连话成绩:${matchingScore.score}分
科目:${matchingScore.subject}
`;
} else {
document.getElementById('resultcontent').innerHTML = '未找到匹配的成绩,请核对信息。';
}
});