This
example only tests if the email address contains an "@" character. Any
"real life" code will have to test for punctuation, spaces and other
things as well.
Code
Head
Code
for Body
<script>
function validate()
{
x=document.myForm
at=x.myEmail.value.indexOf("@")
if (at == -1)
{
alert("Not a valid e-mail")
return false
}
}
</script>
<form
name="myForm"
onsubmit="return validate()">
Enter
your E-mail address:
<input type="text" name="myEmail">
<input type="submit" value="Send input">
</form>