<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <mce:script type="text/javascript"><!-- function validate_required(field,alerttxt){ with(field){ if(value ==null || value ==""){ email_error.innerHTML = alerttxt; return false; }else{ return true; } } } function validate_email(field,alerttxt){ with(field){ op = value.indexOf("@"); op1 = value.lastIndexOf("."); if(op<1 || op1-op <2){ email_error.innerHTML = alerttxt; return false; }else{ return true; } } } function validate_form(thisform){ with(thisform){ if(validate_required(email,"email must be filled out!")==false){ email.focus(); return false; }else if(validate_email(email,"Not a valid email address!") == false){ email.focus(); return false; } } } // --></mce:script> </head> <body> <form action="#" method="post" οnsubmit="return validate_form(this);"> Email: <input type="text" name="email" size="40" /> <input type="submit" value="submit" /> <br /> <span id=email_error style="color: red" mce_style="color: red"></span> </form> </body> </html>