内包含延时网站跳转
判断分数
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>0103</title>
</head>
<body>
<form action="" method="post">
<input type="" name="" id="t" value="" />
<input type="button" name="" id="" value="登录" onclick="dz()" /><br />
<span>学生成绩:<i id="demo"></i></span><br />
<span style="color: gray; visibility:hidden;" id="mm" >正在自动跳转已通过,请等待<span id="Time">5</span>秒</span>
</form>
<script type="text/javascript">
function dz(){
var s=parseFloat(document.getElementById("t").value);
function tz(){
setInterval(function(){
var time = document.getElementById("Time");
if(time.innerHTML == 0){
window.location.href="https://www.icourse163.org/";
}else{
time.innerHTML = time.innerHTML-1;
}
},1000);
document.getElementById("mm").style.visibility="visible";
}
switch(true){
case s <60:
document.getElementById("demo").innerHTML="不及格,不批准通过!!";
break;
case s <75 && s>=60:
document.getElementById("demo").innerHTML="及格,通过!!";
tz();
break;
case s <85 && s>=75:
document.getElementById("demo").innerHTML="良好,通过!!";
tz();
break;
case s>=85:
document.getElementById("demo").innerHTML="优秀,通过!!";
tz();
break;
}
}
</script>
</body>
<html>
|