js验证数字

var quantity=1;

var reg = /^\d+$/;


if (!reg.exec(quantity)){


    alert('只能为数字');

}

猜你喜欢

转载自wsl198632.iteye.com/blog/1738892