0

this is my javascript for validation of a form .It works perfectly

<script type="text/javascript">
function validateForm()
{
var x=document.forms["contacts-form"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
  alert("Not a valid e-mail address");
return false;
  }
var x=document.forms["contacts-form"]["name"].value;
if (x==null || x==""||x=="Name:")
  {
  alert("First name must be filled out");
  return false;
  }
var y=document.forms["contacts-form"]["comment"].value;
if (y==null || y==""||y=="Message:")
  {
  alert("Message must be filled out");
  return false;
  }
}
</script>

Now i want to submit my form without reloading the page. So please help me to modify this code !!!!! I will be very thankful to you
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by aaloo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.