I've added the last piece of javascript to the site. It's a simple form validation for email addresses in the contact form.
Code Snippet:
<script>
function validateForm()
{
var x=document.forms["contactForm"]["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;
}
}
</script>
A tutorial was used from w3 schools.
No comments:
Post a Comment