Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 检查更改javascript时的位数_Html_Numbers_Digits - Fatal编程技术网

Html 检查更改javascript时的位数

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

嗨,我有一个数字输入。 所以它在explorer中运行良好,因为它没有箭头。 在chrome和更新的浏览器中,它不考虑最大长度

  <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”属性指定长度

但它没有帮助,因为我希望用户将更改该框