出現問題。這是我的代碼:點擊「提交按鈕」後文本迅速消失
<html>
<body>
<form>
<p>13-7: <input id="in1" type="text"" /><input type="submit" onclick="check(6, 'in1', 'out1')" value="Tjek!"/></p>
<p id="out1"></p>
<p>20-7: <input id="in2" type="text"" /><input type="submit" onclick="check(13, 'in2', 'out2')" value="Tjek!" /></p>
<p id="out2"></p>
<script type="text/javascript">
function check(facit, input, output) {
var answer, evaluation;
answer = document.getElementById(input).value;
evaluation = (answer == facit) ? "Correct" : "Wrong";
document.getElementById(output).innerHTML = evaluation;
return false;
}
</script>
</form>
</body>
</html>
當我點擊提交按鈕,在「正確/錯誤」僅顯示了片刻。我希望它留在網站上,有任何建議嗎?
剛剛擺脫開*形式*標記,結束標記缺少的,似乎你不使用的形式anythying有用的反正。控件沒有名字,所以不能成功。 – RobG