This article introduces a simple example of JavaScript judging Non-numeric, and a friend in need can refer to the
copy code code as follows:
<title> Determine whether it is a number and a space </title>
<script type= "text/ JavaScript "src=" jquery.min.js ></script>//There is no matter whether there is no
<script type= "Text/javascript"
function Check_num () //Create functions
{
var num=document.getelementbyid ("num") .value; // Get Value (id=num)
if (isNaN (num) | | num== "" | | Num.substring (0,0) ==0) //Note the SUBSTRING function is used to determine the space
{
alert ("Do not enter non-digital");
return false;
}else{
alert ("correct");
}
}
</script>
<body>
Please enter a number: <input type= "text" id= "num" name= "num" value = "" "
<input type=" Submit " value=" submitted "o~n~c~l~i~c~k~=" Check_num ">//This is actually onclick but not write
</ Body>