Knowledge Walls
Ammu
Hyderabad, Andhra Pradesh, India
Passcode:
Nan null undefined in Examples of Javascript 1
876 Views
example
<!DOCTYPE html>
    <html lang="us-EN">
    <head>
        <meta charset="UTF-8">
        <title>form</title>
        <script>
            function clme()
            {
                var Text1=parseInt(document.getElementById('text1').value);
                alert(Text1);
                var Text2=parseInt(document.getElementById('text2').value);
                alert(Text2);
                
                if(isNaN(Text1) || isNaN(Text2))
                    {
                        alert("not numbers");
                    }
                    else
                    {
                          var sum= Text1+Text2;
                          alert("Sum="+sum);
                     }
                
                /*
                alert("hello");
                var firstName=document.getElementById('firstname').value;
                alert(firstName);
                var passWord=document.forms["myForm"]["password"].value;
                alert(passWord);
                var seX=document.forms["myForm"]["sex"].value;
                alert(seX);
                var Languages=document.forms["myForm"]["cpplanguage"].checked;
                alert(Languages);
                var cityName=document.forms["myForm"]["city"].value;
                alert(cityName);
                var  textArea=document.forms["myForm"]["myaddress"].value;
                alert(textArea);
                */
            }
        </script>
        
    </head>
    <body>
        
        <form name="myForm" onsubmit="return clme();">
            First Name:<br>
            <input type="text" name="firstname" id="firstname" value="vidhyaa" style="width:100px"><br>
            Password:<br>
            <input type="password" name="password" ><br>
            Value1:<br>
            <input type="text" id="text1" ><br>
            Value2:<br>
            <input type="text" id="text2" ><br>
            Sex:<br>
            <input type="radio" name="sex" value="male" checked>Male<br>
            <input type="radio" name="sex" value="female">Female<br>
            Languages:<br>
            <input type="checkbox" name="clanguage" value="c">c<br>
            <input type="checkbox" name="cpplanguage" value="c++">c++<br>
            <input type="checkbox" name="javalanguage" value="Java">Java<br>
            Languages known:<br>
            <select name="city">
                <option value="chennai">chennai</option>
                <option value="salem">salem</option>
            </select>
            <textarea name="myaddress">address here</textarea>
            <input type="submit" value="submit">
            <input type="reset" value="reset">
        </form>
    </body>
</html>
Next Topics
Next lessons of current book.
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Previous Topics
Previous lessons of current book.
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Best Lessons of "Javascript 1"
Top lessons which are viewed more times.
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details