Hi all,
I am trying to develop a form with email validation but i am recieving an error which is this
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.3; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Tue, 13 Apr 2010 11:48:06 UTC
Message: Syntax error
Line: 4
Char: 39
Code: 0
URI: file:///C:/Users/williamtosh/Desktop/javascriptvalid.html
This is my code
<script language = "Javascript">
function checkdata()
{
if(document.form-validate.name.value="")
{
alert("You Must enter a name");
return false;
}
else if(document.form-validate.email.value==""||document.form-validate.email.value.length<6)
{
alert("You havnt entered in an valid email address!");
return false;
}
else if(document.form-validate.email.value.indexOf("@")==-1 || document.form-validate.email.value.indexOf(".")==-1)
{
alert("Thats not a valid email address or doesnt exist!");
return false;
}
else
{
alert("Thank you!");
return true;
}
}
</script>
<form name="form-validate" method="post" action="" onsubmit="return checkdata();">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" name="reg" value="Done">
</form>
Why do i get that error above?
can anyone tell me what am i doing wrong?
Thanks,William