function validate(form) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if (document.getElementById("txtName").value == "") {
alert("Please input a valid name.");
return false;
}
if(reg.test(document.getElementById("txtEmail").value) == false) {
alert("Please input a valid email.");
return false;
}
if (!document.getElementById("chkAgree").checked) {
alert("You have not agreed to the terms and conditions.");
return false;
}
return true;
}
<form method="post" action="" onsubmit="return validate(this)">
Sunday, June 20, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment