1
我在my-eclipse IDE
中使用了以下代碼。爲什麼我在構建瀏覽器的Eclipse中使用數字var時沒有獲得輸出?
<html>
<head>
<script>
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)){
return false;
return true;
}
}
</script>
</head>
<body>
<input name="form_number" onkeypress="return isNumberKey(event)" type="text" maxlength="4">
</body>
</html>
上進行測試時,該代碼不返回正確的輸出我的內置瀏覽器在我IDE
。
我試圖在IE上運行這個片段(因此使用外部瀏覽器),並且一切似乎都很好。我覺得我的代碼沒有錯誤,但我可能是錯的。我的代碼是錯誤的還是與瀏覽器相關的這個問題?