<
head runat
=
"
server
"
>
< title > 验证输入Txt的内容全为数字 < / title>
< script type = " text/javascript " language = " javascript " >
function CheckTxt()
{
var regExp = / ^\d+(\.\d+)?$ / ;
var elementTxt = document.getElementById ( " txtCheck " ).value;
if (regExp .test (elementTxt ))
{
alert ( " True " );
return true ;
}
else
{
alert ( " False " );
return false ;
}
}
< / script>
< / head>
< title > 验证输入Txt的内容全为数字 < / title>
< script type = " text/javascript " language = " javascript " >
function CheckTxt()
{
var regExp = / ^\d+(\.\d+)?$ / ;
var elementTxt = document.getElementById ( " txtCheck " ).value;
if (regExp .test (elementTxt ))
{
alert ( " True " );
return true ;
}
else
{
alert ( " False " );
return false ;
}
}
< / script>
< / head>