<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prompt</title>
<script type="text/javascript">
function rec(){
var sorce;
sorce=prompt("请输入你的成绩");
if (sorce>=140)
{document.write("非常棒!");}
if else(sorce>=120)
{document.write("很好");}
if else(sorce>=90)
{document.write("加油哦");}
else
{document.write("要努力了啊");}
}
</script>
</head>
<body>
<input name="button" name="button" onClick="rec()" value="点击我,对成绩做评价!" />
</body>
</html>
2 回答
dommon
TA贡献2条经验 获得超0个赞
js也有错误 if else 改成 else if
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>prompt</title> <script type="text/javascript"> function rec(){ var sorce; sorce=prompt("请输入你的成绩"); if (sorce>=140) {document.write("非常棒!");} else if(sorce>=120) {document.write("很好");} else if(sorce>=90) {document.write("加油哦");} else {document.write("要努力了啊");} } </script> </head> <body> <input name="button" type="button" onClick="rec()" value="点击我,对成绩做评价!" /> </body> </html>
添加回答
举报
0/150
提交
取消