<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

</head>

<body>

 </body>

<script type="text/javascript">

var x="abc";

//isNaN()函数判断是否是NaN

if (isNaN(parseInt(x))) {

alert("非数字");

} else{

alert("数字");

}

</script>

</html>

posted on 2016-10-22 17:35  代码小公主  阅读(33949)  评论(1编辑  收藏  举报