js验证邮箱
<html>
<head>
<script>
function verifyAddress(obj)
{
var email = obj.email.value;
var pattern = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
flag = pattern.test(email);
if(flag)
{
alert("恭喜您!您填写的邮箱地址是正确的!");
return true;
}
else
{
alert("你填写的邮件错误");
}
}
</script>
</head>
<body>
<form onSubmit="return verifyAddress(this);">
<input name="email" type="text">
<input type="submit" value="提交">
</form>
</body>
</html>
例子二:js 时间
<script>
var now=new Date();
var hour=now.getHours();
var minu=now.getMinutes();
alert(hour+":"+minu);
</script>