这段代码报错Uncaught SyntaxError Unexpected end of input at Untitled-1html163!DOCTYPE htmlhtmlhead script windowonload = function ifNumbertop1value+Numbertop2value == top3value alert您已经成功了;else a
<p>这段代码缺少一个大括号,需要在if语句的后面添加一个大括号来匹配if语句的开始。修改后的代码如下:</p>
<!DOCTYPE html>
<html>
<head>
<script>
window.onload = function(){
if(Number(top1.value)+Number(top2.value) == top3.value){
alert("您已经成功了");
}else{
alert("你彻底失败了");
}
}
</script>
<meta charset="UTF-8" />
<title>title</title>
</head>
<body>
<input type="" name="">
<input type="button" name="" value="+" id="top1">
<input type="" name="">
<input type="button" name="" value="=" id="top2">
<input type="" name="" id="top3">
<br>
<input type="" name="">
<input type="button" name="" value="+" id="top4">
<input type="" name="">
<input type="button" name="" value="=" id="top5">
<input type="" name="">
<br>
<input type="button" name="" value="查询结果">
</body>
</html
原文地址: https://www.cveoy.top/t/topic/fxNr 著作权归作者所有。请勿转载和采集!