<span style= "font-family:arial, Helvetica, Sans-serif; Background-color:rgb (255, 255, 255); " > Write a custom JavaScript function checkemail (), in which first determine whether the e-mail text box is empty, and then in the application of regular expressions to determine whether the e-mail address is legitimate, if not legally prompt users </span>
<span style= "font-family:arial, Helvetica, Sans-serif; Background-color:rgb (255, 255, 255); " ></span><pre name= "Code" class= "JavaScript" ><script type= "text/javascript" > function Checkemail () { var email = document.getElementById ("email"), if (Email.value = = NULL | | email.value = = "") {alert (" Please enter the e-mail address! "); Email.focus (); return;} var regExp =/\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) */;if (!regexp.test (email.value)) {alert ("The e-mail address you entered is incorrect!"); Email.focus (); return;} } </script><span style= "White-space:pre" ></span>
JavaScript determines whether an e-mail address is legitimate