How to e-mail?

How to validate email address like [email protected] using javascript onsubmit method.?

  • This script send email [email protected]. But not send [email protected](email address). how to send like this email([email protected]). I used script below. form_validation.js function EmailValid(email) { if(email=="") { alert("Email is required field!") return false } len = email.length if((email.charAt(1)=='@')||(email.ch… { alert("Invalid Email Please try again!") return false } if((email.charAt(len-2)=='@')||(emai… { alert("Invalid Email Please try again!") return false } count=0 dotcount=0 for (i=0; i< email.length; i++) { if(email.charAt(i)=='@') count++ if(email.charAt(i)=='.') dotcount++ } if((count !=1)||(dotcount !=1)) { alert("Invalid Email Please try again!") return false } return true } myform.js function valForm() { if(!EmailValid(document.myform.email… { return false } }

  • Answer:

    Use regular expressions to validate emails. Its far easier and your code will only be a few lines

Dulanjal... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.