js有个函数 isNaN(val) //如果是数字则返回 false

使用

代码片段
5 行
if(!isNaN(val)){
   alert("是数字");
}else{
   alert("不是数字");
}

js判断是否为数字