标签:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<style type=text/css>
</style>
<script type="text/javascript">
function check(){
var obj=document.getElementById("email");
if(obj.value!=""){
var str = obj.value;
if(str.indexOf("@")!=-1){
if(str.indexOf(".")!=-1){
var a=str.split("@");
if(a[0].length >1 ){document.getElementById("mess").innerHTML="<font color=‘green‘>正确</font>";
}else{document.getElementById("mess").innerHTML="<font color=‘red‘>错误</font>";
}
}else{
document.getElementById("mess").innerHTML="<font color=‘red‘>错误</font>";
}
}else{
document.getElementById("mess").innerHTML="<font color=‘red‘>错误</font>";
}
}
}
</script>
</head>
<body>
<label>email:</label><input type="text" id="email">
<input type="button" value="验证" onclick="check()">
<span id="mess"></span>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/yangqiongfu/p/4929059.html