在编译非常简单的代码时出现代码0错误。我该如何解决? 我第一次使用VS 2017。
<html>
<head>
<script>
function calculate(){
alert("In calculate fn") // NOT REACHING HERE;
var x = document.getElementByName("SNUM");
document.getElementById("answer_area").innerHTML = x * x;
}
</script>
</head>
<body>
<form>
<table cellspacing = "2" cellpadding = "2" border = "1">
<tr>
<td align = "right">Enter a number: </td>
<td><input type = "text" name = "SNUM" /></td>
</tr>
</table>
</form>
<br>
<button onclick="calculate()">Square it</button>
<b><u><br><br>Answer:</b></u>
<p id="answer_area"></p> <!-- answer to be placed here; -->
</body>
</html>
不应在中间的两行!
海姆