您的位置:首页 > Web前端 > JavaScript

JavaScript检查电话格式与email格式

2008-11-19 14:46 363 查看
function checkPhone()
{
if(true)
{
document.getElementById("spanPhone").innerHTML = "<font color='red'></font>";
}
}

function checkEmail()
{
var re=/^/w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*$/;
var email = document.getElementById("email").value;
if((!re.test(email))&&(email!=""))
{
document.getElementById("spanEmail").innerHTML = "<font color='red'>请输入邮箱的正确形式!</font>";
document.getElementById("email").value="";
return false;
}
document.getElementById("spanEmail").innerHTML = "<font color='red'></font>";
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: