You can use the isNaN function to determine if a value does not convert to a number.(您可以使用isNaN函数确定值是否不转换为数字。)
Example as below:(示例如下:)
function checkInp()
{
var x=document.forms["myForm"]["age"].value;
if (isNaN(x))
{
alert("Must input numbers");
return false;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…