Vous êtes sur la page 1sur 4

<!

--
Assignment No. : 2
Roll No. : 10
Name : Asmita A. Gadekar
Batch :A
Title : An HTML Program To Create And Validate Registration Form Using Vbscrpit
-->
<html>
<head>
<center> <font face="Monotype Corsiva" size="+4" color="#660066"> Registration Form
</font></center>
<script type="text/vbscript">
function validate()
if(form1.first.value)="" then
msgbox("Enter First Name...")
else
txt=form1.first.value
flag=0
for i=1 to len(txt)
ch=Mid(txt,i,1)
if (asc(ch)<65 or asc(ch)>90) and (asc(ch)<97 or asc(ch)>122)
then
flag=1
end if
next

if flag=1 then
msgbox("Numbers and Symbols are Not Allowed...")
end if
end if
'--------------------------------------------------------------------------------------------'
if(form1.mid.value)="" then
msgbox("Enter Middle Name...")
else
txt=form1.mid.value
flag=0
for i=1 to len(txt)
ch=Mid(txt,i,1)
if (asc(ch)<65 or asc(ch)>90) and (asc(ch)<97 or asc(ch)>122)
then
flag=1
end if
next
if flag=1 then
msgbox("Numbers and Symbols are Not Allowed...")

end if
end if
'-------------------------------------------------------------------------------------------'
if(form1.last.value)="" then
msgbox("Enter Last Name...")
else
txt=form1.last.value
flag=0
for i=1 to len(txt)
ch=Mid(txt,i,1)
if (asc(ch)<65 or asc(ch)>90) and (asc(ch)<97 or asc(ch)>122) then
flag=1
end if
next
if flag=1 then
msgbox("Numbers and Symbols are Not Allowed...")

end if
end if
'------------------------------------------------------------------------------------------'
if (form1.mail.value)="" then
msgbox("Enter Email Id...")
else
if Instr(form1.mail.value,"@")=0 then
msgbox("Enter Valid Email Id...")
end if
end if
'-----------------------------------------------------------------------------------------'
if (form1.pass.value)="" then
msgbox("Enter Password...")
end if
'-----------------------------------------------------------------------------------------'

if (form1.con.value)="" then
msgbox("Enter Contact Number...")
else
if Not IsNumeric(form1.con.value) then
msgbox("Enter A Valid Contact Number...")
end if
end if
end function
'-------------------------------------------------------------------------------------------------------------------'
function clearall()
form1.first.clear()
form1.mid.clear()
form1.last.clear()
form1.mail.clear()
form1.pass.clear()
form1.con.clear()
end function
</script>
</head>
<!---------------------------------------------------------------------------------------------------------------->
<br><br><br>
<body>
<center>
<form name="form1">
<table cellpadding="5" border="0" height="400" width="500" bgcolor="#F5E0F5">
<tr>
<td> <font size="+1"> First Name : </font> </td>
<td> <input type="text" name="first" size="30"> </td>
</tr>
<tr>
<td> <font size="+1"> Middle Name : </font> </td>
<td> <input type="text" name="mid" size="30"> </td>
</tr>
<tr>
<td> <font size="+1"> Last Name : </font> </td>
<td> <input type="text" name="last" size="30"> </td>
</tr>

<tr>
<td> <font size="+1"> Email Id : </font> </td>
<td> <input type="text" name="mail" size="30"> </td>
</tr>
<tr>
<td> <font size="+1"> Password : </font> </td>
<td> <input type="password" name="pass" size="30"> </td>
</tr>
<tr>
<td> <font size="+1"> Contact No. : </font> </td>
<td> <input type="text" name="con" size="30"> </td>
</tr>
<tr align="center">
<td align="right"> <input type="submit" value="SUBMIT"
onClick="validate()"> </td>
<td align="left"> <input type="submit" value="CLEAR" onClick="clearall()"> </td>
</tr>
</table>

</form>
</center>
</body>
</html>

Vous aimerez peut-être aussi