Email address validation

Email Address Validation- Using JavaScript validation statement we can check valid Email Address

E.g.
<html> 
<head> 
<title>Email Validation</title> 
</head> 
<body>
Check email address entered is valid or not!  
<form name="form1">
Enter Email Address:<input type="text" name="mail">
<input type="button" onclick="check()" value="Check">
</form>
<script language="javascript">
function check()
{
x=document.form1.mail.value;
if(x==0) 
{
alert("No Email address entered" + "\n" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}
else if(!((x.indexOf(".") > 0) && (x.indexOf("@") > 0)) || /[^a-zA-Z0-9.@]/.test(x))  
{
alert("The Email address is invalid" + "\n" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}
else
{
alert("Valid Email address entered" + "\n" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}  
}
</script>
</body> 
</html>
Check Output: Email Validation Check email address entered is valid or not!
Enter Email Address:


Related Topics:
  1. JavaScript Introduction
  2. Variables in JavaScript
  3. JavaScript Function
  4. Accessing JavaScript Function
  5. Creating JavaScript interactive form
  6. Accessing form field value
  7. Creating interactive form login webpage
  8. Networking Fundamentals
  9. TCP/IP and Internet addressing
  10. Internet Working
  11. Internet Working Servers
  12. Concept and need for web publishing
  13. Web languages
  14. Javascript Control Structure
  15. Checking Text is Letter/s
  16. Checking Text is Number/s
  17. Checking Textbox is Empty or not
  18. Addition of two numbers
  19. Subtraction of two numbers
  20. Multiplication of two numbers
  21. Division of two numbers
  22. Form field validations
  23. Email validation