<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var name = document.getElementById("txtName").value;
var regxname = /[a-z]{1}\d*/;
var checkname = regxname.test(name);
var email = document.getElementById("txtEmailId").value;
var regxemail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
var checkemail = regxemail.test(email);
var phone = document.getElementById("txtLandLineNo").value;
var regxphone = /\d{2}([-]*)\d{2}([-]*)\d{8}/;
var checkphone = regxphone.test(phone);
if (name == null || name == "") {
alert("Please Enter Name");
return false;
}
if (checkname == null || checkname == "") {
alert("Name Enter Start with letters..");
return false;
}
// else {
// alert("Name Successfully Entered..");
// return true;
// }
if (email == null || email == "") {
alert("Please Enter Email");
return false;
}
if (checkemail == null || checkemail == "") {
alert("Email Enter with Proper Format..");
return false;
}
// else {
// alert("Email Successfully Entered..");
// return true;
// }
if (phone == null || phone == "") {
alert("Please Enter Land phone No..");
return false;
}
if (checkphone == null || checkphone == "") {
alert("Phone Enter with Proper Format..");
return false;
}
else {
alert("Phone Successfully Entered..");
return true;
}
}
</script>
</head>
<body>
<form action="HTMLPage2.htm" >
<div align="center" style="background-color: Silver" >
<table>
<tr>
<td colspan='3'>
Registration Form
</td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td>
<input id="txtName" type="text" />
</td>
</tr>
<tr>
<td>E-mail Id</td>
<td>:</td>
<td>
<input id="txtEmailId" type="text" />
</td>
</tr>
<tr>
<td>Land-Line Number</td>
<td>:</td>
<td>
<input id="txtLandLineNo" type="text" />
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<input id="btnSubmit" type="button" value="Submit" onclick="return f1()" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var name = document.getElementById("txtName").value;
var regxname = /[a-z]{1}\d*/;
var checkname = regxname.test(name);
var email = document.getElementById("txtEmailId").value;
var regxemail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
var checkemail = regxemail.test(email);
var phone = document.getElementById("txtLandLineNo").value;
var regxphone = /\d{2}([-]*)\d{2}([-]*)\d{8}/;
var checkphone = regxphone.test(phone);
if (name == null || name == "") {
alert("Please Enter Name");
return false;
}
if (checkname == null || checkname == "") {
alert("Name Enter Start with letters..");
return false;
}
// else {
// alert("Name Successfully Entered..");
// return true;
// }
if (email == null || email == "") {
alert("Please Enter Email");
return false;
}
if (checkemail == null || checkemail == "") {
alert("Email Enter with Proper Format..");
return false;
}
// else {
// alert("Email Successfully Entered..");
// return true;
// }
if (phone == null || phone == "") {
alert("Please Enter Land phone No..");
return false;
}
if (checkphone == null || checkphone == "") {
alert("Phone Enter with Proper Format..");
return false;
}
else {
alert("Phone Successfully Entered..");
return true;
}
}
</script>
</head>
<body>
<form action="HTMLPage2.htm" >
<div align="center" style="background-color: Silver" >
<table>
<tr>
<td colspan='3'>
Registration Form
</td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td>
<input id="txtName" type="text" />
</td>
</tr>
<tr>
<td>E-mail Id</td>
<td>:</td>
<td>
<input id="txtEmailId" type="text" />
</td>
</tr>
<tr>
<td>Land-Line Number</td>
<td>:</td>
<td>
<input id="txtLandLineNo" type="text" />
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<input id="btnSubmit" type="button" value="Submit" onclick="return f1()" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
No comments:
Post a Comment