Hello All,

I have made the following form. But i want to be able to validate the email address so that it must have a @ and not include / \ " etc

Any ideas?


Code:
<script type="text/javascript">
 function CheckForm() {
  tbName=document.forms[0].name.value;
  if (tbName == '') {
   alert('Name is required.');
   return false;
  }

   tbaddress=document.forms[0].address1.value;
  if (tbaddress == '') {
   alert('Address Line 1 is required.');
   return false;
  }
  tbaddress2=document.forms[0].address2.value;
  if (tbaddress == '') {
   alert('Address Line 2 is required.');
   return false;
  }
  tbcity=document.forms[0].city.value;
  if (tbcity == '') {
   alert('City is required.');
   return false;
  }


  tbpostcode=document.forms[0].postcode.value;
  if (tbpostcode == '') {
   alert('Post Code is required.');
   return false;
  }
  
  tbemail=document.forms[0].emailaddress.value;
  if (tbemail == '') {
   alert('Email is required.');
   return false;
  }

   return true;
  }
</script>

<form onsubmit="return CheckForm();">
  <p>
  <label for="Name">Name:*</label>  
  <input type="text" name="name" size="50" />  
  <br>
  <label for="address1">Address Line 1:*</label>
  <input type="text" name="address1" size="50" />
  <br>
  <label for="address2">Address Line 2:*</label>  
  <input type="text" name="address2" size="50" /> 
  <br>
  <label for="City">City:*</label>
 
  <input type="text" name="City" size="50" /> 
  <br>
   <label for="County">County:*</label>
    <input type="text" name="County" size="50" /> 
  <br>
  <label for="zip">Post Code:*</label> 
  <input type="text" name="postcode" />
  <br>  
  <label for="email">Email Address:*</label>  
  <input type="text" name="emailaddress" size="50" /> 
  <br> 

  <label>Can we use your email address for marketing:</label>
  <br />
  <input type="checkbox" name=Yes value="Yes" checked />
  <span>Yes</span>
  <input type="checkbox" name=No value="No"/>
  <span>No</span>
 <br />

<input type="submit"> 
</form>