Html 检查更改javascript时的位数
嗨,我有一个数字输入。 所以它在explorer中运行良好,因为它没有箭头。 在chrome和更新的浏览器中,它不考虑最大长度Html 检查更改javascript时的位数,html,numbers,digits,Html,Numbers,Digits,嗨,我有一个数字输入。 所以它在explorer中运行良好,因为它没有箭头。 在chrome和更新的浏览器中,它不考虑最大长度 <input type="text" id="amount2" name="quantity2" class="amountBox" value="0" onchange="ChangeSecondAmount(this.value)" maxlength="4" onkeypress="return /\d/.test(String.fromCharCod
<input type="text" id="amount2" name="quantity2" class="amountBox" value="0" onchange="ChangeSecondAmount(this.value)" maxlength="4" onkeypress="return /\d/.test(String.fromCharCode(((event||window.event).which||(event||window.event).which)));"/>
也许我可以改变onkeypress功能来检查数字量
非常感谢。使用“max”属性指定长度 但它没有帮助,因为我希望用户将更改该框