function checkall(str)
{
var d,i,formname,emailexp,broc_val;
d=mm_findobj(str);
emailexp=/^[_\.a-z0-9]+@[a-z0-9]+[\.][a-z0-9]{2,3}$/gi;
broc_val=0;
for (i=1;i<d.length-1;i++)
{
if(d[i].value.replace(/ /g,'')=='')
{
alert('some information is missing.');
return false;
}
if(d[i].name=='email_home' && emailexp.test(d[i].value.replace(/ /g,''))==false)
{
alert('invalid e-mail address');
return false;
}
}
{
var d,i,formname,emailexp,broc_val;
d=mm_findobj(str);
emailexp=/^[_\.a-z0-9]+@[a-z0-9]+[\.][a-z0-9]{2,3}$/gi;
broc_val=0;
for (i=1;i<d.length-1;i++)
{
if(d[i].value.replace(/ /g,'')=='')
{
alert('some information is missing.');
return false;
}
if(d[i].name=='email_home' && emailexp.test(d[i].value.replace(/ /g,''))==false)
{
alert('invalid e-mail address');
return false;
}
}
<head>
<script>
function checkEmail()
{
var strEmail = txt1.value;
var myReg = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
if(myReg.test(strEmail))
return true;
alert("E-mail非法!");
return false;
}
</script>
</head>
<body>
<input type=text name="txt1">
<input type=button onclick="checkEmail()" value="check Email">
</body>
</html>