Posted on 2008-06-14 20:52
疯狂水车 阅读(296)
评论(0) 编辑 收藏 引用 所属分类:
Javascript技巧
function submit_onclick()
{
var name,email_address,objemail_address;
name = document.policy.name.value;
email_address = document.policy.email_address.value;
objemail_address = document.policy.email_address;
if (name=="" || email_address=="" )
{
alert("Fields marked with an asterisk * are required.");
return false;
}
else
{
var reEml = /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i;
var isOk=reEml.test(objemail_address.value);
if (isOk==false)
{
alert("Invalid E-mail Address!");
objemail_address.focus();
}
document.policy.action = "*.asp";
document.policy.submit();
}
}