<input type="text" runat="server" id="txt_checkingPhone" onkeyup="checkRate(this.id)"/> (请输入数字)
<script type="text/javascript" language="javascript">
function checkRate(input)
{
var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
var nubmer = document.getElementById(input).value;
if (!re.test(nubmer))
{
alert("请输入数字");
document.getElementById(input).value = "";
return false;
}
}
</script>