+ 1

Email Validation in Javascipt

Can anyone help me with this code... it is not working after the email validation <script> function dwork() { var name, age, password, pincode, sexcode, contact; name= document.f1.t1.value; age= document.f1.t2.value; password= document.f1.t3.value; email= document.f1.t4.value; contact=document.f1.t6.value; if (document.f1.t5[0].checked==true) { sexcode="Male"; } else { sexcode="Female"; } for(var i=0; i<name.length;i++) { if (name.charAt(i)<'A' || name.charAt(i)>'Z') alert("Sorry please enter a name in capital letter"); break; } if ( age>27) { alert("please fill the form only if your age is above 18 "); document.f1.t2.focus(); } else if (password==name) { alert("please enter a genuine password"); document.f1.t3.focus(); } else if (contact.length!=10) { alert("please enter a valid contact number of 10 digits"); document.f1.t6.focus(); } else if (!/^[a-z0-9._-]+@[a-z0-9.-]+\.[a-z]{2,4}$/g.test(document.f1.t4.value)) { alert("Please enter valid email address."); document.f1.t4.focus(); } else if (document.f1.t5[0].checked==false && document.f1.t5[1].checked==false) { alert("please choose the sexcode"); document.f1.t5.focus(); } else alert("HELLO \n welcome " + name+ "\n AGE "+age +"\n Password " +password+"\n email "+email + "\n sexcode " + sexcode + "\n Contact Number #" + contact); } </script>

22nd Dec 2018, 1:24 PM
ROBOKIT
ROBOKIT - avatar
1 Réponse
+ 3
Your code is incomplete, without showing the html code.
23rd Dec 2018, 2:05 AM
Calviղ
Calviղ - avatar