JSP控制输入框只能输入数字并且限制输入小数为两位
<input id="sale_income" class="form-control" placeholder="默认到小数点后两位" onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,‘$1$2.$3‘)" onafterpaste="this.value=this.value.replace(/\D/g,‘‘)" maxlength="15" name="sale_income" type="text" >
文章来自:http://www.cnblogs.com/xmy59/p/5982196.html