Global.isNaN() : isNaN : Global JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Global » isNaN »

 

Global.isNaN()









Syntax








isNaN(variable)



The isNaN() function is used to determine whether variable is a valid number.












<html>
    <body>
    <script lanuguage="JavaScript">
    <!--
    function checkNum(){
        var n = document.form1.text1.value;
        if(isNaN(n== true){
           alert("Your entry is not a number");
        }else{
           alert("Your entry is a number");
        }
    }
    -->
    </script>
    <form name="form1">
    Enter a number or character into the text box and then click the check value
    button to verify if the input is a number.
    <br><br>
    <input type="text" name="text1" size=3>
    <br><br>
    <input type="button" value="Check value" onClick='checkNum()'>
    <br>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Global
» isNaN