2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by DeadlyMan
1

Here Some Full Example :)

<html>
<head>

<script language="javascript">

function validate(form_id,email,out) {

   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
    
   if(reg.test(address) == false) {

      document.forms[form_id].elements[out].value='* Invalid Email Address';
      return false;
   }

	document.forms[form_id].elements[out].color='black';
   document.forms[form_id].elements[out].value='Valid Email Address :)';
   
   
}
</script>

</head>

<form id="frm" method="POST" action="">
	
	<p><input type="text" name="username" size="20"><p>
	<input type="text" name="password" size="20"><p>
	<input type="text" name="email" size="20" onkeypress="validate('frm','email','out');"><p>
	    <input id="out" style="border-style: none; border-color: inherit; border-width: 0px; background: white; font-family: tahoma; font-size: small; color: red; width: 141px;" disabled="disabled"/></td><p>
	&nbsp;&nbsp;<input type="submit" value="Submit" name="B1">
</form>

</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.