Comparison | function | The following function can check the email address format, only in the form of:
ABC@ABC.ABC,ABC@ABC.ABC.ABC and ABC@ABC.ABC.ABC.ABC-like strings to pass the check,
The following illegal addresses will not pass:
@abc @163.net,abc@163..net,abc@163.net.,abc@163@net and so on can be struck out.
What are the e-mail addresses in these formats? Like what:
swuse@yeah.net,liaojiayuan@btamail.net.cn,abc@public.yj.gd.cn
Is there any longer?
<script language= "JavaScript1.2" >
function checkmail (mail)
var strr;
re=/(\w+@\w+\.\w+) (\.{ 0,1}\w*) (\.{ 0,1}\w*)/I;
re.exec (mail);
if (regexp.$3!= "&®exp.$3!=".) &®exp.$2!= ".") Strr=regexp.$1+regexp.$2+regexp.$3
Else
if (regexp.$2!= "" &®exp.$2!= ".") Strr=regexp.$1+regexp.$2
else strr=regexp.$1
if (strr!=mail) {alert ("Please fill in the correct mail address; return false}"
return true;
}
</script>