/// <summary>
/// 检测数字字符串
/// </summary>
/// <param name="m">最小值</param>
/// <param name="n">最大值</param>
/// <param name="strText">字符串</param>
/// <returns>验证成功后,返回true</returns>
function IsNumberStr(m, n, strText) {
try {
if (strText.replace(/\s/g, "") == "") {
alert("输入不能为空,请重新输入");
return false;
}
var strCheck = /^[0-9]{1,}$/;
if (!strText.match(strCheck)) {
alert("字符串只能由数字组成");
return false;
}
if (strText.length > n || strText.length < m) {
alert("字符串长度有误,请核实后再输入");
return false;
}
return true;
}
catch (ex) {
alert("数字字符串验证失败!");
return false;
}
}