标签:style class blog code color cti
//onfocusout="checkQty(this);"
function checkQty(obj) { //排除0开头的非法输入 if (obj.value.length >= 2) { var a = obj.value.charAt(0); var b = obj.value.charAt(1); if (a == ‘0‘ && b != ‘.‘) { obj.value = ‘0‘; alert(‘请输入正确的数字格式!‘); return; } } //数字验证 var regExp = new RegExp(/^\d+(\.\d+)?$/); var result = regExp.test(obj.value); if (!result) { obj.value = ‘0‘; alert(‘请输入正确的数字格式!‘); } }
标签:style class blog code color cti
原文地址:http://www.cnblogs.com/zhongxinWang/p/3785245.html