<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form action="" method="post">
<input type="text" id="fraction" placeholder="请输入分数"/>
<input type="button" value="请求奖励" οnclick="fr()"/>
</form>
<div id="dp"></div>
<script type="text/javascript">
function fr(){
let fraction=document.getElementById('fraction').value;
console.log(fraction);
fraction = parseInt(fraction);
if(fraction <0 || fraction>100) {
fraction=document.getElementById('dp').innerHTML='请输入1-100之间的数';
fraction = parseInt(fraction);
return;
}
let msg='';
if(fraction <=100 && fraction>=90){
msg='奖励两个雪糕';
}else if(fraction>=80){
msg='奖励一个雪糕';
}else if(fraction>=70){
msg='奖励女子单打';
}else if(fraction>=60){
msg='奖励男子单打';
}else if(fraction>=0){
msg='奖励混合双打';
}else if(escape(fraction).indexOf( "%u" )<0){
msg= "包含字符";
}
document.getElementById('dp').innerHTML=msg;
}
</script>
</body>
</html>
05-28