|
|
|
7i24.Com不停为您服务 检查指定Text输入框的值是否是数值型数据
作者: xiaohe
本函数用于检查指定Text输入框的值是否是数值型数据
// txtName : 文本输入框对象
// sLabel : 文本输入框的标签名称;如:年龄,数量等
//-----------------------------------------------------------------------------------
function JHshIsNumber(txtName,sLabel)
{
var strTemp = "";
if (isNaN(txtName.value) || (txtName.value.length == 0))
{
strTemp = "“" + sLabel + "”必须是数值型数据。";
window.alert(strTemp) ;
txtName.value = "0";
// txtName.select() ;
txtName.focus() ;
return false ;
}
else
{
return true ;
}
}
|
|
|