摘要:效果: 代码: 效验meail 邮箱地址: function checkMe
效果:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>效验meail</title>
</head>
<body>
<br>
<center>
<form>
邮箱地址:<input name="meail_input_name" type = "text" id="meail_input_id" value="" placeholder="请输入正确的邮箱">
<input name="meail_check_name" type = "button"id="meail_check_id" value="效验邮箱" onclick="checkMeail()">
</form>
</center>
</br>
</body>
<script type="text/javascript">
function checkMeail(){
var meailAddress=document.getElementById("meail_input_id").value;
//长度
var meailLength = meailAddress.length;
//判断含有@,“.”
var index1 = meailAddress.indexOf("@");
var index2 = meailAddress.indexOf(".");
var msg = "效验输入的邮箱号n";
msg += "@所在的索引:==:"+index1;
msg += "\'.\'所在的索引:==:"+index2;
msg +="邮箱地址:"+meailAddress+"n";
msg +="验证邮箱地址的实例:"
if (index1==-1||index2==-1||index1<index2) {
msg +="邮箱的基本要求:"+"n";
msg +="必须含有\'@\'和\'.\'+n";
msg +="\'.\'必须在\'@\'后面n";
}else{
msg += "符合要求";
};
alert(msg);
}
</script>
</html>
相关文章推荐
已有家长中招!“录取通知书”邮件暗藏骗局2022-09-06
连接企微和钉钉,新网全球邮助力企业协同办公2022-09-27
快速申请搭建免费企业邮箱的教程2022-09-16
如何避免你的外贸开发信被当成垃圾邮件?2022-09-14
2021年,全国企业邮箱用户共收发邮件约7637.7亿封2022-09-13