function CheckEmail(address){
address=address.replace(/(^\s*)|(\s*$)/g, "");
var reg=/([\w._-])+@([\w_-])+(\.([\w_-])+){1,2}/;
var matcharr=reg.exec(address);
if(matcharr!=null){
if(matcharr[0].length==address.length){
return true;
}
return false;
}
return false;
}
eg:
var sVal=" t.st@gmail.com.cn ";
var sVal2=" t.st@gmail.com.cn.abc ";
console.log(CheckEmail(sVal)); //outpus true
console.log(CheckEmail(sVal2)); //outpus false
试试吧^_^