javascript 关于数字的验证
是否数字:
if (isNaN($(this).val())) { alert(it is not a number) ; }
是否是正整数:
var value = parseInt($(this).val()) if (value < 0 || value != $(this).val()) { alert("it is not Signed Integer") ; }
大道至简
是否数字:
if (isNaN($(this).val())) { alert(it is not a number) ; }
是否是正整数:
var value = parseInt($(this).val()) if (value < 0 || value != $(this).val()) { alert("it is not Signed Integer") ; }