0% found this document useful (0 votes)
95 views11 pages

2 Ndques

The document describes code to validate user login, registration, profile, and payment pages using JavaScript. It includes code snippets for login and registration pages that validate fields like username, password, and credit card details. It also includes code for a user profile page that displays user information.

Uploaded by

devipallapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views11 pages

2 Ndques

The document describes code to validate user login, registration, profile, and payment pages using JavaScript. It includes code snippets for login and registration pages that validate fields like username, password, and credit card details. It also includes code for a user profile page that displays user information.

Uploaded by

devipallapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 11

Program:2

Validate the Registration, User Login, User Profile and Payment by Credit Card pages using JavaScript.

Source Code:

Login Page(login.html):
<html>
<head>
<script type="text/JavaScript">
function check()
{
if(document.login.id.value=="" || document.login.pwd.value=="" ||
document.login.id.value.length<6 || document.login.id.length>12)
{
alert("Invalid Username and password! Try again");
document.login.id.focus();
}
else
{
alert("Login Successful");
window.location.href='bookcat.html';
}
}
</script>
</head>

<body bgcolor="greenyellow">
<br>
<marquee behavior=alternate>
<font color=blue><h1>Login Your Account</h1></font>
</marquee><br><br>
<hr>
<center><b>
<a href="main.html" target="_parent">Home</a>&nbsp;
<a href="bookcat.html" target="_parent">Catalog</a>&nbsp;
<a href="userpro.html" target="_parent">My Account</a>&nbsp;
<a href="aboutus.html" target="_parent">About us</a>&nbsp;
<a href="contactus.html" target="_parent">Contact us</a>&nbsp;
</b></center>
<hr>
<br><br><br>
<form name="login">
<center><pre><font size=5 face="monotype corsiva"><b> Login Id: </b><input type="text"
name="id">
<b>Password: </b><input type="password" name="pwd"><br></font></pre>
<pre> <input type="button" name="home" value="HOME"
onClick="window.location.href='main.html'"> <input type="button" name="Ok" value="OK"
onClick="check()"> <input type="reset" name="clear" value="CLEAR"></pre>
<pre><font size=4 face="cambria"> <a href="main.html" target="_parent">Forgot
Password</a> <font color="red">|</font> <a href="reg.html" target="_parent">Sign
up</a></font></pre></center>
</form>
</body>
</html>
Registration Page(reg.html):

<html>
<head>
<script type="text/JavaScript">
function fnam()
{
if(document.reg.fname.value.length<6 || document.reg.fname.value.length>12)
{
alert("First Name should be between 6 and 12");
document.reg.fname.focus();
}
}
function cvno()
{
if(document.reg.cvvno.value!=1234)
{
alert("Invalid CVV no.");
document.reg.cvvno.focus();
}
}
</script>
</head>

<body bgcolor="cyan">
<marquee behavior=alternate>
<font color=blue><h1>Register Your Details</h1></font>
</marquee><br>
<hr>
<center><b>
<a href="main.html" target="_parent">Home</a>&nbsp;
<a href="bookcat.html" target="_parent">Catalog</a>&nbsp;
<a href="userpro.html" target="_parent">My Account</a>&nbsp;
<a href="aboutus.html" target="_parent">About us</a>&nbsp;
<a href="contactus.html" target="_parent">Contact us</a>&nbsp;
</b></center>
<hr><br>
<form name="reg" method="post" action="main.html">
<center>
<table border=0 width="80%">
<tr>
<td align="right"><b>Name</b></td>
<td width="544"><input type="text" name="fname" value="First"
onBlur="fnam()">&nbsp;<input type="text" name="lname" value="Last"></td>
</tr>
<tr>
<td align="right"><b>Sex</b></td>
<td><input type="radio" name="sex" value="male" checked>Male&nbsp;&nbsp;<input
type="radio" name="sex" value="female">Female</td>
</tr>
<tr>
<td align="right"><b>Login Id</b></td>
<td><input type="text" name="id"></td>
</tr>
<tr>
<td align="right"><b>Password</b></td>
<td><input type="text" name="pwd"></td>
</tr>
<tr>
<td align="right"><b>Re-type Password</b></td>
<td><input type="text" name="rpwd"></td>
</tr>
<tr>
<td align="right"><b>Date of Birth</b></td>
<td><select name="dobd">
<option selected>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
<option>11
<option>12
<option>13
<option>14
<option>15
<option>16
<option>17
<option>18
<option>19
<option>20
<option>21
<option>22
<option>23
<option>24
<option>25
<option>26
<option>27
<option>28
<option>29
<option>30
<option>31
</select>&nbsp;/&nbsp;
<select name="dobm">
<option selected>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
<option>11
<option>12
</select>&nbsp;/&nbsp;
<input type="text" name="doby" size=2 maxlength=4>&nbsp;(DD/MM/YYYY)</td>
</tr>
<tr>
<td align="right"><b>e-mail id</b></td>
<td><input type="text" name="email" size=40></td>
</tr>
<tr>
<td align="right"><b>Security Question</b></td>
<td>
<select name="sq" style="width:25em">
<option selected>-Select One-
<option value="Where did you meet your spouse?">Where did you meet your
spouse?
<option value="What was the name of your first school?">What was the
name of your first school?
<option value="Who was your childhood hero?">Who was your childhood
hero?
<option value="What is your favorite pastime?">What is your favorite
pastime?
<option value="What is your favorite sports team?">What is your favorite
sports team?
<option value="What is your father's middle name?">What is your father's
middle name?
<option value="What was your high school mascot?">What was your high
school mascot?
<option value="What make was your first car or bike?">What make was your
first car or bike?
<option value="What is your pet's name?">What is your pet's name?
</select>
</td>
</tr>
<tr>
<td align="right"><b>Your Answer</b></td>
<td><input type="text" name="ans" size=40></td>
</tr>
<tr>
<td align="right"><b>Country</b></td>
<td>
<select name="country" style="width:15em">
<option value="au" selected>Australia
<option value="ca">Canada
<option value="cn">China
<option value="co">Colombia
<option value="eg">Egypt
<option value="de">Germany
<option value="hk">Hong Kong
<option value="is">Iceland
<option value="in" selected>India
<option value="it">Italy
<option value="jp">Japan
<option value="pk">Pakistan
<option value="ru">Russia
<option value="lk">Sri Lanka
<option value="us">United States
</select>
</td>
</tr>
<tr>
<td align="right"><b>Postal Code</b></td>
<td><input type="text" name="pcode"></td>
</tr>
<tr>
<td align="right"><b>Card Holder Name</b></td>
<td><input type="text" name="chn"></td>
</tr>
<tr>
<td align="right"><b>Credit card No</b></td>
<td><input type="text" name="ccno"></td>
</tr>
<tr>
<td align="right"><b>CVV No</b></td>
<td><input type="text" name="cvvno" size=2 maxlength=4 onBlur="cvno()"></td>
</tr>
<tr>
<td align="right"><b>Expiry Date</b></td>
<td><select name="expd">
<option selected>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
<option>11
<option>12
</select>&nbsp;/&nbsp;
<input type="text" name="doby" size=2 maxlength=4>&nbsp;(DD/MM/YYYY)</td>
</tr>
<tr>
<td align="right"><b>Type the code shown</b></td>
<td><input type="text" name="code"></td>
</tr>
<tr>
<td align="right" valign="top"><b><a href="" target="_parent">Try different
imgage</a></b></td>
<td><img border="0" src="images/pa.jpg" width="290" height="80" alt="Image not
found"></td>
</tr>
<tr>
<td align="right" valign="top"><b>Do you agree?</b></td>
<td><input type="checkbox" name="agree">&nbsp;I have read and agree to the <a
href="">Terms of Service</a> and <a href="">Privacy Policy</a>, and to receive
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;important communications from electronically.For your
convenience, these documents &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will be emailed to your
Mail account.</td>
</tr>
</table>
<br>
<input type="submit" name="submit" value="submit">&nbsp;&nbsp;&nbsp;<input type="reset"
name="reset">
</center>
</form>
</body>
</html>
User Profile Page(userpro.html):

<html>
<body bgcolor="pink">
<br>
<font color=blue><h1 align="center">Welcome to User Profile</h1></font>
<br>
<hr>
<center><b>
<a href="main.html" target="_parent">Home</a>&nbsp;
<a href="bookcat.html" target="_parent">Catalog</a>&nbsp;
<a href="userpro.html" target="_parent">My Account</a>&nbsp;
<a href="aboutus.html" target="_parent">About us</a>&nbsp;
<a href="contactus.html" target="_parent">Contact us</a>&nbsp;
</b></center>
<hr>
<h2><center><font color="green" face="monotype corsiva" size=6><u>User
Profile</u></font></center></h2>
<form action="main.html" method="post" name="userpro">
<center>
<table border=0 width="70%">
<tr>
<td align="right"><b>Name:&nbsp;</b></td>
<td width="350">PVPSIT</td>
</tr>
<tr>
<td align="right"><b>Login id:&nbsp;</b></td>
<td width="350">pvpsit_vja</td>
</tr>
<tr>
<td align="right"><b>Password:&nbsp;</b></td>
<td width="350">pvpsit</td>
</tr>
<tr>
<td align="right"><b>Sex:&nbsp;</b></td>
<td width="350">male/female</td>
</tr>
<tr>
<td align="right"><b>Date of Birth:</b></td>
<td>10/10/2004</td>
</tr>
<tr>
<td align="right"><b>e-mail Id:</b></td>
<td><a href="mailto:[email protected]">[email protected]</a></td>
</tr>
<tr>
<td align="right"><b>Country:&nbsp;</b></td>
<td width="350">India</td>
</tr>
<tr>
<td align="right"><b>Postal Code:&nbsp;</b></td>
<td width="350">520 011</td>
</tr>
<tr>
<td align="right"><b>Card Holder Name:&nbsp;</b></td>
<td width="350">pvpsit</td>
</tr>
<tr>
<td align="right"><b>Credit card No:&nbsp;</b></td>
<td width="350">4433222111</td>
</tr>
</table>
</center>
</form>
</body>
<script>
alert("Welcome to Mr/Mrs.PVPSIT");
</script>
</html>

You might also like