write a program to Validate the registration, user login, user profile and payment by credit card pages using JavaScript. - Code

Latest

programs

Friday, October 7, 2011

write a program to Validate the registration, user login, user profile and payment by credit card pages using JavaScript.


2. Validate the registration, user login, user profile and payment by credit card pages using JavaScript.


REGISTRATION FORM


<Html>
<Head>
<Title>User Registration Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" fptype="dynamicanimation">
</script>
</head>
<body>
<script language="javascript">
function verify(form)
{
if(document.forms[0].elements[0].value=="")
{
alert("Please Enter User ID");
document.forms[0].elements[0].focus();
return(false);
}
if(document.forms[0].elements[1].value=="")
{
alert("Please Enter your Password");
document.forms[0].elements[2].value="";
document.forms[0].elements[1].focus();
return(false);
}
if(document.forms[0].elements[1].value.length<4)
{
alert("Password must be greater than 4 character");
document.forms[0].elements[1].value="";
document.forms[0].elements[2].value="";
document.forms[0].elements[1].focus();
return(false);
}
if(document.forms[0].elements[2].value=="")
{
alert("Please Enter your Confirm Password");
document.forms[0].elements[2].focus();
return(false);
}
if((document.forms[0].elements[1].length)!=(document.forms[0].elements[2].length))
{
alert("Your Password does not match with Confirm Password");
document.forms[0].elements[1].value="";
document.forms[0].elements[2].value="";
document.forms[0].elements[1].focus();
return(false);
}




if((document.forms[0].elements[1].length)==(document.forms[0].elements[2].length))
{
if((document.forms[0].elements[1].value)!=(document.forms[0].elements[2].value))
{
alert("Your Password does not match with Confirm Password");
document.forms[0].elements[1].value="";
document.forms[0].elements[2].value="";
document.forms[0].elements[1].focus();
return(false);
}
}
if(document.forms[0].elements[3].value=="secq")
{
alert("Please Select your Security Question");
document.forms[0].elements[3].focus();
return(false);
}
if(document.forms[0].elements[4].value=="")
{
alert("Please Answer the security question");
document.forms[0].elements[4].focus();
return(false);
}
if(document.forms[0].elements[5].value=="DD")
{
alert("Please select Day of DOB");
document.forms[0].elements[5].focus();
return(false);
}
if(document.forms[0].elements[6].value=="MM")
{
alert("Please select Month of DOB");
document.forms[0].elements[6].focus();
return(false);
}
if(document.forms[0].elements[7].value=="YYYY")
{
alert("Please select Year of DOB");
document.forms[0].elements[7].focus();
return(false);
}
if(document.forms[0].elements[10].checked==true)
{
if(document.forms[0].elements[11].value=="")
{
alert("Please Enter your First Name");
document.forms[0].elements[11].focus();
return(false);
}
if(document.forms[0].elements[13].value=="")
{
alert("Please Enter your Last Name");
document.forms[0].elements[13].focus();
return(false);
}
if(document.forms[0].elements[14].value=="Year")
{
alert("Please specify your Academic year");
document.forms[0].elements[14].focus();
return(false);
}
if(document.forms[0].elements[15].value=="adminyear")
{
alert("Please put your Admission Year");
document.forms[0].elements[15].focus();
return(false);
}
if(document.forms[0].elements[16].value=="dept")
{
alert("Please Select your Department");
document.forms[0].elements[16].focus();
return(false);
}
if(document.forms[0].elements[17].value=="")
{
alert("Please put your Roll Number");
document.forms[0].elements[17].focus();
return(false);
}
if(document.forms[0].elements[17].value!="")
{
r0=document.forms[0].elements[17].value.indexOf('2');
r1=document.forms[0].elements[17].value.indexOf('k');
r2=parseInt(document.forms[0].elements[17].value.charAt(2));
r3=document.forms[0].elements[17].value.indexOf('_');
r4=parseInt(document.forms[0].elements[17].value.charAt(4));
r5=parseInt(document.forms[0].elements[17].value.charAt(5));
r6=parseInt(document.forms[0].elements[17].value.charAt(6));
len=document.forms[0].elements[17].value.length;
if((len!=7)||(r0!=0)||(r1!=1)||(r3!=3)||(r4>6 || r4<1)||(r2>9 || r2<1))
{
alert("Not a valid Roll Number");
document.forms[0].elements[17].focus();
return(false)
}
switch(document.forms[0].elements[16].value)
{
case 'IT':
if(r4!=6||(r5>4||r5<0)||(r6>9||r6<0))
{
alert("Not a valid Roll Number of Information Technology");
document.forms[0].elements[16].focus();
return(false)
}break;
case 'CSE':
if(r4!=5||(r5>4||r5<0)||(r6>9||r6<0))
{
alert("Not a valid Roll Number of Computer Science");
document.forms[0].elements[16].focus();
return(false)
}break;
case 'ECE':
if(r4!=4||(r5>4||r5<0)||(r6>9||r6<0))
{
alert("Not a valid Roll Number of Electronics");
document.forms[0].elements[16].focus();
return(false)
}break;
case 'EE':
if(r4!=2||(r5>6||r5<0)||(r6>9||r6<0))
{
alert("Not a valid Roll Number of Electrical Engineering");
document.forms[0].elements[16].focus();
return(false)
}break;
case 'ME':
if(r4!=3||(r5>6||r5<0)||(r6>9||r6<0))
{
alert("Not a valid Roll Number of Mechanical Engineering");
document.forms[0].elements[16].focus();
return(false)
}break;
case 'CE':
if(r4!=1||(r5>6||r5<0)||(r6>9||r6<0))
{
alert("Not a valid Roll Number of Civil Engineering");
document.forms[0].elements[16].focus();
return(false)
}break;
}
switch(document.forms[0].elements[14].value)
{
case 'Fourth':
if(r2!=1||(r2>9||r2<0))
{
alert("Not a valid Roll Number of Forth Year");
document.forms[0].elements[14].focus();
return(false)
}break;
case 'Third':
if(r2!=2||(r2>9||r2<0))
{
alert("Not a valid Roll Number of Third Year");
document.forms[0].elements[14].focus();
return(false)
}break;
case 'Second':
if(r2!=3||(r2>9||r2<0))
{
alert("Not a valid Roll Second Year");
document.forms[0].elements[14].focus();
return(false)
}break;


case 'First':
if(r2!=4||(r2>9||r2<0))
{
alert("Not a valid Roll Number of First Year");
document.forms[0].elements[14].focus();
return(false)
}break;
}
}
}
if(document.forms[0].elements[24].checked==true)
{
if(document.forms[0].elements[25].value=="")
{
alert("Please Enter Your First Name");
document.forms[0].elements[25].focus();
return(false);
}
if(document.forms[0].elements[27].value=="")
{
alert("Please Enter your Last Name");
document.forms[0].elements[27].focus();
return(false);
}
if(document.forms[0].elements[30].value=="state")
{
alert("Please Select Your State");
document.forms[0].elements[30].focus();
return(false);
}
if(document.forms[0].elements[31].value=="country")
{
alert("Please Select Your State");
document.forms[0].elements[31].focus();
return(false);
}
if((document.forms[0].elements[32].value=="pincode")||(document.forms[0].elements[33].value=""))
{
alert("Please Select Your Pincode OR if Other specify");
document.forms[0].elements[32].focus();
return(false);
}
}
}
function studentclear(form)
{
document.forms[0].elements[11].value="";
document.forms[0].elements[12].value="";
document.forms[0].elements[13].value="";
document.forms[0].elements[14].value="Year";
document.forms[0].elements[15].value="adminyear";
document.forms[0].elements[16].value="dept";
document.forms[0].elements[17].value="";
document.forms[0].elements[18].value="selecthostel";
document.forms[0].elements[19].value="";
document.forms[0].elements[20].value="";
document.forms[0].elements[21].value="";
document.forms[0].elements[22].value="";
document.forms[0].elements[23].value="";
document.forms[0].elements[25].focus();
}
function generalclear(form)
{
document.forms[0].elements[25].value="";
document.forms[0].elements[26].value="";
document.forms[0].elements[27].value="";
document.forms[0].elements[28].value="City";
document.forms[0].elements[29].value="";
document.forms[0].elements[30].value="state";
document.forms[0].elements[31].value="country";
document.forms[0].elements[32].value="pincode";
document.forms[0].elements[33].value="";
document.forms[0].elements[34].value="";
document.forms[0].elements[35].value="";
document.forms[0].elements[36].value="";
document.forms[0].elements[37].value="";
document.forms[0].elements[11].focus();
}
</script>
<body onLoad=document. forms [0].elements[0].focus();>
<form action ="" method="post" onsubmit="return verify(this.form)">
<center>
<p dynamicanimation="fpAnimelasticRightFP1" id="fpAnimelasticRightFP1"
style="position: relative !important; visibility: hidden" language="Javascript1.2">
<font size="6" face="Monotype Corsiva" color="#800000">New User Registration Form</font></p>
</center><br>
<i><font color="#FF0000"><font face="Arial" size="4">*</font>
<font face="Arial" size="2"></font> </font>
<font face="Arial" size="2"color="#FF0000">Indicates all the fields are mandatory</font></i><hr><p>
<font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000">*</font>
<font size="-1" face="Arial, Helvetica,sans-serif">User ID:</font><b>
<input name="uid" size="16" maxlength="15"></b>
<font color="#FF0033" size="2"> </font>
<font face="Arial" size="2" color="#FF0033">
(Contains only letters (a-z), numbers (0-9) and underscore)</font>
<br><b><br></b>
<font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000">*</font>
<font size="-1" face="Arial, Helvetica,sans-serif">Password: </font>
<font color="#000000"> </font>
<input type="password" name="pswd" size="9" maxlength="10" style="font-weight: bold; color:#008000">
<font color="#000000"size="2"><font face="Arial"> </font></font>
<font color="#FF0033" size="2" face="Arial">
(Password should be of minimum 4(four) and maximum 10(ten) characters. </font>
<font size="2"><font color="#FF0033" face="Arial">) </font></p>
</font> <font face="ARIAL, HELVETICA" size="-1"> </font>
<font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000">*</font>
<font face="ARIAL, HELVETICA" size="-1">Re-Type Password</font>:<font size="2"> <b>
<input type="password" name="cpswd" size="11" maxlength="10" style="color:#008000" ></b> </font>
<hr><font size="2"> </font><font size="2">
<font face="Arial, Helvetica, sans-serif">
<i>If you forget your password, you can retrieve it by answering your unique hint question. <br>
Frame your question such that only you know its answer.
</i></font></font>
<div align="center"><font face="Arial" size="2"></font>
<font face="Arial" size="2"></font><font face="Arial" size="2"></font>
<font face="Arial" size="2"></font></div>
<font face="Arial" size="2"><br></font>
<font size="2"><font face="Arial">
<font face="Arial,Helvetica, sans-serif"></font></font></font>
<font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000">*</font>
<font size="2"><font face="Arial">
<font face="Arial, Helvetica,sans-serif">
Select a question forgetting password </font><b>: </b></font>
<select size="1" name="secq">
<option selected value="secq">Select a hit question ?</option>
<option value="What is your favourite multimedia software?">
What is your favourite multimedia software?</option>
<option value="What is your favourite game?">What is your favourite game?</option>
<option value="who is your favourite Cricketer?">
who is your favourite Cricketer? </option>
<option value="who is your favourite Film Actor?">
who is your favourite Film Actor?</option>
<option value="what is your favourite food?">what is your favourite food?</option>
</select><font face="Arial"><b>
</b></font></font><p><font size="2">
</font><font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000">*</font>
<font color="#000000" face="Arial, Helvetica, sans-serif" size="2">Hit Answer:
<input type="text" name="seca" size="21"> </font>
<font size="2"><font color="#000000" face="Arial, Helvetica,sans-serif"> </font>
<font color="#FF0033" face="Arial">(Write Your Answer)</font>
<font color="#000000" face="Arial"> </font>
</font><font size="1"></p></font>
<hr><div align="left"><font face="Arial,Helvetica, sans-serif" size="-1">
DD MM YYYY <br>
</font>
<font size="4" face="Arial, Helvetica, sans-serif"color="#FF0000">*</font>
<font face="Arial, Helvetica, sans-serif" size="-1">Date of Birth:
<select size="1" name="DD">
<option selected value="DD">Day</option> <option value="1">1</option>
<option value="2">2</option> <option value="3">3</option>
<option value="4">4</option> <option value="5">5</option>
<option value="6">6</option> <option value="7">7</option>
<option value="8">8</option> <option value="9">9</option>
<option value="10">10</option> <option value="11">11</option>
<option value="12">12</option> <option value="13">13</option>
<option value="14">14</option> <option value="15">15</option>
<option value="16">16</option> <option value="17">17</option>
<option value="18">18</option> <option value="19">19</option>
<option value="20">20</option> <option value="21">21</option>
<option value="22">22</option> <option value="23">23</option>
<option value="24">24</option> <option value="25">25</option>
<option value="26">26</option> <option value="27">27</option>
<option value="28">28</option> <option value="29">29</option>
<option value="30">30</option> <option value="31">31</option>
</select>
<select size="1" name="MM">
<option selected value="MM">Month</option><option value="JANUARY">JAN</option>
<option value="FEBRUARY">FEB</option> <option value="MARCH">MAR</option>
<option value="APRIL">APR</option> <option value="MAY">MAY</option>
<option value="JUNE">JUN</option> <option value="JULY">JUL</option>
<option value="AUGUST">AUG</option> <option value="SEPTEMBER">SEP</option>
<option value="OCTOBER">OCT</option><option value="NOVEMBER">NOV</option>
<option value="DECEMBER">DEC</option>
</select>
<select size="1" name="YYYY">
<option selected value="YYYY">Year</option> <option value="1970">1970</option> <option value="1971">1971</option> <option value="1972">1972</option> <option value="1973">1973</option> <option value="1974">1974</option> <option value="1975">1975</option> <option value="1976">1976</option> <option value="1977">1977</option> <option value="1978">1978</option> <option value="1979">1979</option> <option value="1980">1980</option> <option value="1981">1981</option> <option value="1982">1982</option> <option value="1983">1983</option> <option value="1984">1984</option> <option value="1985">1985</option> <option value="1986">1986</option> <option value="1987">1987</option> <option value="1988">1988</option> <option value="1989">1989</option> <option value="1990">1990</option> <option value="1991">1991</option> <option value="1992">1992</option> <option value="1993">1993</option> <option value="1994">1994</option> <option value="1995">1995</option> <option value="1996">1996</option> <option value="1996">1996</option> <option value="1997">1997</option> <option value="1998">1998</option> <option value="1999">1999</option> <option value="2000">2000</option> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2009</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select></font></div>
<p><font face="Arial, Helvetica, sans-serif" size="-1"></font>
<font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000">*</font>


<font face="Arial, Helvetica, sans-serif" size="-1">
Gender:
<input type="radio" name="Male" value="male" checked> Male
<INPUT type=radio value="female" name="Male" >Female
</font>
<hr><font size="4" face="Arial, Helvetica, sans-serif" color="#FF0000"> </font>
<p> <font face="Arial, Helvetica, sans-serif" size="-1">
Contact No: <input type="text" size="6" name="std" maxlength="6"><b> -</b>
<input type="text" size="9" name="phno" maxlength="9">
</font><p>
<font face="Arial, Helvetica, sans-serif" size="-1">
Mobile No: <input type="text" size="18" name="mobno" maxlength="15"></font><p> <font face="Arial, Helvetica, sans-serif" size="-1">
Email:<input type="text" name="email" size="20">
</font><p><hr>
<div align="left"><font face="Arial, Helvetica, sans-serif" size="-1">
</font> </div><center>
<input type="submit" value="Submit" name="Submit" tabindex="25">
<input type="reset" value="Reset" name="Reset" tabindex="26">
</center></form></body></html>


output:


[IMG]http://i29.tinypic.com/2dsitqq.jpg[/IMG]

No comments:

Post a Comment