0% found this document useful (0 votes)
7 views2 pages

String

The document is an HTML registration form that requires users to input their name, address, login, password, confirm password, and email. It includes JavaScript validation to ensure all required fields are filled, checks the length of the login and password, and verifies that the password matches the confirmation. Alerts are triggered for any validation errors before the form can be submitted.

Uploaded by

ahsanhasnain2834
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

String

The document is an HTML registration form that requires users to input their name, address, login, password, confirm password, and email. It includes JavaScript validation to ensure all required fields are filled, checks the length of the login and password, and verifies that the password matches the confirmation. Alerts are triggered for any validation errors before the form can be submitted.

Uploaded by

ahsanhasnain2834
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

DOCTYPE html>

<html>

<head>

<title>Registration Form</title>

<script type="text/javascript">

function chk()

{var a = document.loginpage.name.value;

var b = document.loginpage.address.value;

var c = document.loginpage.login.value;

var d = document.loginpage.password.value;

var e = document.loginpage.cpassword.value;

var f = document.loginpage.email.value;

var maxlength = 15;

var minlength = 3;

if (a === "" || b === "" || c === "") {alert("Please fill all required values."); return false;}

if (c.length > maxlength || c.length < minlength) {alert("Login should range between " +
minlength + " and " + maxlength + " characters."); return false; }

if (d.length > maxlength || d.length < minlength) {alert("Password should range between " +
minlength + " and " + maxlength + " characters."); return false; }

for (var i = 0; i < c.length; i++) {if (c.charAt(i) === "," || c.charAt(i) === ";") {alert("Invalid Login
Name: no commas or semicolons allowed."); return false; }}

if (d !== e) {alert("Password does not match Confirm Password."); return false; } return true; }

</script>

</head>

<body>

<h1>To register please enter the following information</h1>


<form name="loginpage" onsubmit="return chk();">

Name: <input type="text" name="name" maxlength="25"><br><br>

Address: <input type="text" name="address" maxlength="50"><br><br>

Login: <input type="text" name="login" maxlength="20"><br><br>

Password: <input type="password" name="password" maxlength="15"><br><br>

Confirm Password: <input type="password" name="cpassword" maxlength="15"><br><br>

E-mail: <input type="text" name="email"><br><br>

<input type="submit" name="sbmt" value="Submit">

<input type="reset" name="reset" value="Reset">

</form>

</body>

</html>

You might also like