金额正则 小数点前8位 后 2位
作者:chrispy
<input type="text" class="input" /><script type="text/javascript">$(function () {$('.input').focusout(function () {var val = $(this).val();var dom = $(this);isSum(val,dom);})});function isSu
<input type="text" class="input" />
<script type="text/javascript">
$(function () {
$('.input').focusout(function () {
var val = $(this).val();
var dom = $(this);
isSum(val,dom);
})
});
function isSum(val,dom) {
var num = val;
var exp = /^([1-9][d]{0,7}|0)(.[d]{1,2})?$/;
if (exp.test(num)) {
dom.removeClass('C');
dom.addClass('Z');
} else if(num == ''){
dom.removeClass('Z');
} else {
dom.removeClass('Z');
dom.addClass('C');
}
}
</script>