Hi I am trying to create a form that has a user enter their email address in a text box and clicks the “Submit” button, once it submits it adds the users email address and checks to make sure its a valid email. If the user enters any other character other than “@” or “.” (for an example “/”) then a message should display with the focus on the area where the mistake was made. After the email validates, I wanted it to be added as an element in an array for the user can click on the “find” button for an example by typing in one letter such as “c” it would bring up any emails stored that begin with the letter “c”. This is what I did so far and it only checks to make sure the email is in the correct format.
html><head><meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Check Email Address</title>
<script language=”javascript”>
function checkEmail(inputvalue){
var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9.
if(pattern.test(inputvalue)){
alert(“true”);
}else{
alert(“false”);
}
}
</script>
</head><body>
<form name=”signupform”>
Input your email: <input name=”email” type=”text” class=”inputs” id=”email_address”
value=”
<input name=”summit” type=”submit” value=”Check” onClick=”checkEmail(document.signupform.email.value)”>
</form></body></html>