String.prototype.isemail = function (){return /^[\w\d]([\w\d\.]*[\w\d])?@([\w\d\-]\.)+[a-z]{2,}$/.test(this);}
//说明:允许 -.com域名格式;
alert('dddd@d.od'.isemail())
/*
---------------------------
来自网页的消息
---------------------------
true
---------------------------
确定
---------------------------
*/
alert('dddd@d.o'.isemail())
---------------------------
来自网页的消息
---------------------------
false
---------------------------
确定
---------------------------