js調用正則表達式

//驗證是否爲正整數
        function isPositiveInteger(s) { var re = /^[0-9]+$/; return re.test(s); } if (exchangeCount === "" || exchangeCount === "0" || Number(exchangeCount) === NaN || !isPositiveInteger(exchangeCount))// Number(exchangeCount) === NaN ,若是是非值類型返回值即爲NAN

{ $(
"#ValidateExchangeCount").text("請輸入正確的換貨數量"); validateResult = false; } else
{ $(
"#ValidateExchangeCount").text(""); }
相關文章
相關標籤/搜索