How to validate input type just email and number using javascript

Good afternoon guys, hope you enjoy your life, in my country has been rain, oke i will give small tutorial that validate input type just email and number, let’s say you have 2 input type

<script type="text/javascript">
            /*here for number */
                function isNumberKey(evt){
                     var charCode = (evt.which) ? evt.which : event.keyCode;
                     if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
                      return false;
                     return true;       
/*here for email */
                    function validateForm()
                    var x=document.forms["myform"]["email"].value;
                    var atpos=x.indexOf("@");
                    var dotpos=x.lastIndexOf(".");
                    if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
                      alert("Email tidak Valid");
                      return false;


    /*here for validate, dont forget give same name myform */
            <form method="post" action="" method="post"   onSubmit="return validateForm();" name="myform">
                    <td><input type="text" name="number">
                    <td><input type="text" name="email">

                    <td><input type="submit" name="submit" value="submi">





Dont forget make coffe, Cheers :D