<?xml version ="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "_//w3c//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>GMail id page</title>
<script language="javascript">
function username()
{
var a,ser;
a=document.getElementById("user name");
ser=a.value.search(/^\w+@\w+\.com$/);
if(ser!=0)
{
alert("Enter valid email id");
a.focus();
a.select();
}
}
function fname()
{
var a;
a=document.getElementById("fcheck");
if(a.value.length == 0)
{
alert("Name cant be empty");
a.focus();
}
}
function lenpw()
{
var a;
a=document.getElementById("password");
if(a.value.length>7)
;
else
{
alert("Password length must be more than 8");
a.focus();
a.select();
}
}
function pw2()
{
var a,b;
a=document.getElementById("password");
b=document.getElementById("passwordre");
if(a.value!=b.value)
{
alert("Passwords dont match");
a.focus();
a.select();
}
}
function phone()
{
var a,ser;
a=document.getElementById("phoneno");
ser=a.value.search(/^\d+$/);
if(ser!=0)
{
alert("enter a valid phone number");
a.focus();
a.select();
}
}
function day1()
{
var a;
a=document.getElementById("Day");
if(a.value>0)
{if(a.value>31)
{
alert("enter a valid date");
a.focus();
a.select();
}
}
else
{
alert("enter a valid date");
a.focus();
a.select();
}
}
function year1()
{
var a,day=new Date();
a=document.getElementById("Year");
if(a.value>day.getFullYear())
{
alert("enter a year before "+day.getFullYear());
a.focus();
a.select();
}
}
function email()
{
var a,ser;
a=document.getElementById("e-mail");
ser=a.value.search(/^\w+@\w+\.com$/);
if(ser!=0)
{
alert("Enter valid email id");
a.focus();
a.select();
}
}
function loc()
{
var a;
a=document.getElementById("location");
if(a.value.length==0)
{
alert("Location cant be empty");
a.focus();
}
}
function tnc()
{
var a;
a=document.getElementById("terms");
if(!a.checked)
{
alert("You must agree to our terms and conditions to proceed");
a.focus();
}
}
</script>
</head>
<body>
<img src="google_logo.png" />
<h1 style="color:red">Create a new Google account </h1>
<form action=" " >
<p><label>Name <br /><input type="text" id="fcheck" size="30" onblur="fname();" /></label></p>
<p><label><input type="text" id="laname" size="30" onblur="lname();"/></label></p>
<p><label>Choose your username <br /><input type="text" id="user name" size="30" onblur="username();" /></label></p>
<p><label>Create a new password <br /><input type="password" id="password" size="30" onblur="lenpw();" /></label></p>
<p><label>Confirm your password <br /><input type="password" id="passwordre" size="30" onblur="pw2();" /></label></p>
<p>Birthday(MM/DD/YYYY)<br />
<select name="month">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option></select>
<label><input type="text" id="Day" size="2" onblur="day1();" /></label>
<label><input type="text" id="Year" size="4" onblur="year1();"/></label></p>
<p>Gender<br />
<select name="Gender">
<option>Male</option>
<option>Female</option></select></p>
<p><label>Mobile Phone <br /><input type="text" id="phoneno" size="15" onblur="phone();"/></label></p>
<p><label>Current e-mail address <br /><input type="text" id="e-mail" size="20" onblur="email();"/></label></p>
<p><label>Location <br /><input type="text" id="location" size="20" onblur="loc();"/></label></p>
<p><label><br /><input type="checkbox" id="terms" />I agree to the terms and conditions</label></p>
<p><input type="button" value="Submit" onclick="tnc();"/></p>
</form>
</body>
</html>
No comments:
Post a Comment