添加 如果不允许添加负号 可以把这块注释掉
if (t == '-') {
obj.value = '-' + obj.value;
}
}
function checkNum(obj) {
//为了去除最后一个.
obj.value = obj.value.replace(/\.$/g,"");
}
function DigitInput(obj,event) {
//响应鼠标事件,允许左右方向键移动
event = window.event || event;
if (event.keyCode == 37 | event.keyCode == 39) {
return;
}
obj.value = obj.value.replace(/\D/g,"");
}
原文链接:https://www.f2er.com/js/45397.html
}
function DigitInput(obj,event) {
//响应鼠标事件,允许左右方向键移动
event = window.event || event;
if (event.keyCode == 37 | event.keyCode == 39) {
return;
}
obj.value = obj.value.replace(/\D/g,"");
}