這是測試代碼,沒有使用按鈕,第二個文本框會接受數字如果值爲< =第一個文本框。第二個輸入類型=「數字」的值不能超過第一個輸入類型的值=「number」maxlength =「3」
<html>
<body>
<input id="first" name="first" type="number" maxlength = "3">
<input id="second" name="second" type="number" maxlength = "3" onblur="compare()" >
</body>
</html>
<script type="text/javascript">
function compare()
{
var firstNumber = document.getElementById("first").value;
var secondNumber = document.getElementById("second").value;
if(firstNumber >= secondNumber)
{
//nothing will do, continue to the 3rd textbox.
}
else
{
alert("The number you enter is larger than the first one.");
//clear the value of the second textbox
}
}
</script>
您的標題是您正在獲取的錯誤消息,還是您想要實現的目標?究竟是什麼問題?附:看起來像純html,沒有asp-classic/vbscript代碼。 – Dijkgraaf
對不起,先生,我的壞..,我將這個代碼導入到我的asp文件(完整的代碼),如果我的關注解決。 – rabal
那麼你的問題是什麼?代碼是否按預期工作? – Dijkgraaf