Rabu, 15 April 2009

TUgas REmidi




NE SCRITNya

<html>
<body>

<script language="JavaScript">

function chkuname()
{
uname=new String();
uname=document.regis.uname.value
if ( uname.length == 0 )
{
alert ("Enter a User Name");
}
else
{
chkupass()
}
}

function chkupass()
{
upass=new String();
upass=document.regis.upass.value
if (upass.length < 5)
{
alert ("Password Must be atleast 6 Chars");
}
else
{
chkname()
}
}

function chkname()
{
var ch=0;
name=new String();
name=document.regis.name.value;

if (name.length==0)
alert ("Enter your Name")
else
{
u=0;
for (i=0;i<name.length;i++)
{
if ((name.charCodeAt(i) >= 64 && name.charCodeAt(i) <= 90)||(name.charCodeAt(i) >= 97 && name.charCodeAt(i) <= 122)||(name.charCodeAt(i)==46)||(name.charCodeAt(i)==32))
{
}
else
{
u=u+1;
}
}
if (u>0)
{
alert ("Invalid Name");
}
else
{
chkdob()
}
}
}

function chkdob()
{
dob=new String();

dob=document.regis.dob.value
if (dob.length!=10)
alert ("Invalid Date")
else
{
if (dob.charAt(2)!="/" && dob.charAt(5)!="/")
alert ("Invalid Date Format")
else
tempstr=dob.split("/")
dd=tempstr[0]
mm=tempstr[1]
yy=tempstr[2]
if (dd>=1 && dd<=31 && mm>=1 && mm<=12 && yy>=1900 && yy<=2004 )
{
chkemail()
}
else
alert ("Enter Valid date")
}
}

function chkemail()
{
mail=new String();

Tidak ada komentar: