HTML Lab Evaluation 3 Roll No: CB - EN.U4CSE21114 Name: D.N.Kharinandan Q1. Source Code

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Html Lab Evaluation 3

Roll No: CB.EN.U4CSE21114

Name: D.N.Kharinandan

Q1.

Source Code:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Enter the following details</title>

<script>

function validateEmail(email){

if(email.includes('@') == true){

if(email.includes('.com') == true){

return true;

return false;

function validatePassword(password){

if(password.length >= 6 && password.length <= 8){

return true;

return false;

var x = document.getElementById("myCheck").checked;
if (x==false){

alert("Select any one ");

function validateAndSubmit(){

let name = document.getElementById("user_name").value;

let address = document.getElementById("user_address").value;

let phone = document.getElementById("user_mobile").value;

let email = document.getElementById("user_email").value;

let password = document.getElementById("user_password").value;

let confirm_email = document.getElementById("verify_email").value;

let male = document.getElementById("male_option").value;

let Female = document.getElementById("female_option").value;

if(name == ""){

document.getElementById('user_name').innerHTML =" Please fill the


name field";

return false;

if(password == ""){

document.getElementById('user_password').innerHTML =" Please fill


the password field";

return false;

if(verify_email == ""){

document.getElementById('verifye').innerHTML =" Please fill the


confirm email field";

return false;

if(validateEmail(email) == false){
alert("Email should have @ and .com");

return;

if(validatePassword(password) == false){

alert("Password can have only 6 to 8 characters!!\nTry Again!!");

if((pass_word.length <= 6) || (pass_word.length > 8)) {

document.getElementById('password').innerHTML ="Passwords lenght


must be between 6 and 8";

return false;

</script>

</head>

<body>

<h1>Enter the following details</h1>

<form name="personal details" action="hari1.html">

<label>Enter Your First Name</label>

<input type="text" id="name" required>


<label>Enter Your Last Name</label>

<input type="text" id="name" required><br><br>

<label>Enter Permenant Address</label><br>

<textarea type ="text" id="address" name="address" rows="4"


cols="50" required></textarea><br><br>

<label>Gender</label>

<input type="radio" id="male" value="Male" name="Gender"


required>

<label for="male">Male</label>

<input type="radio" id="female" value="Female"


name="Gender">

<label for="female">Female</label><br><br>

<label>You email Please</label>

<input type="email" id="user_email" required><br><br>

<label>Reenter Your email</label>

<input type="email" id="verify_email" required><br><br>

<label>Your Telephone number</label>

<input type="number" id="user_mobile" required><br><br>

<label>Enter your Password (6-8 characters)</label>

<input type="password" id="user_password" required><br><br>

<label id = mycheck>Which are the two subjects you like


most</label>

<input type="checkbox" value="UI Design" >

<input type="checkbox" value="C Programming" >

<input type="checkbox" value="CS Essentials" >


<input type="checkbox" value="Physics" ><br><br>

<label>How many hours do you study daily - 1 to 6


hours</label>

<input type="range" value="1 to 6" value="6"><br><br>

<input type="submit" value="Click to submit"


onclick="validateAndSubmit()">

<input type="reset" value="Press to Reset or Clear">

</form>

</body>

</html>

Output:

You might also like