Web-Design-Lab[1]
Web-Design-Lab[1]
Objective
The objective of this experiment is to create a student registration form and use different type of
input, eg: text, number, email, date, file etc
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
form {
background: #ffffff;
padding: 20px 40px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
max-width: 700px;
margin: auto;
border: 1px solid #ccc;
}
input[type="text"], input[type="number"], input[type="email"], input[type="date"], select,
input[type="file"], textarea {
width: 100%;
padding: 10px;
margin: 10px 0;
border-radius: 5px;
border: 1px solid #ccc;
}
.button-container {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
input[type="submit"], input[type="button"] {
background: #5cb85c;
border: none;
color: white;
padding: 10px;
border-radius: 5px;
cursor: pointer;
width: 48%;
}
input[type="submit"]:hover, input[type="button"]:hover {
background: #4cae4c;
}
.hobbies {
display: flex;
flex-wrap: wrap;
}
.hobbies label {
margin-right: 10px;
}
</style>
<script>
function submitForm(event) {
event.preventDefault();
if (confirm("Are you sure you want to submit the form?")) {
window.location.href = 'submit.html';
}
}
function resetForm(event) {
event.preventDefault();
if (confirm("Are you sure you want to reset the form?")) {
document.querySelector("form").reset();
}
}
</script>
</head>
<body>
<center>
<h2>Student Registration Form</h2>
</center>
<form onsubmit="submitForm(event)">
<label for="first_name">First Name:</label>
<input type="text" id="first_name" name="first_name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="gender">Gender:</label><br>
<label><input type="radio" id="male" name="gender" value="male" required> Male</label>
<label><input type="radio" id="female" name="gender" value="female"> Female</label>
<label><input type="radio" id="other" name="gender" value="other"> Other</label><br>
<label for="nationality">Nationality:</label>
<input type="text" id="nationality" name="nationality" required>
<label for="course">Course:</label>
<select id="course" name="course" required>
<option value="BTech">BTech</option>
<option value="BBA">BBA</option>
<option value="BCA">BCA</option>
<option value="Other">Other</option>
</select>
<label for="branch">Branch:</label>
<input type="text" id="branch" name="branch" required>
<label for="address">Address:</label>
<textarea id="address" name="address" rows="3" required></textarea>
<label>Hobbies:</label>
<div class="hobbies">
<label><input type="checkbox" name="hobbies" value="Reading"> Reading</label>
<label><input type="checkbox" name="hobbies" value="Travelling"> Travelling</label>
<label><input type="checkbox" name="hobbies" value="Sports"> Sports</label>
<label><input type="checkbox" name="hobbies" value="Music"> Music</label>
<label><input type="checkbox" name="hobbies" value="Art"> Art</label>
<label><input type="checkbox" name="hobbies" value="Cooking"> Cooking</label>
</div>
<div class="button-container">
<input type="submit" value="Register">
<input type="button" value="Reset" onclick="resetForm(event)">
</div>
</form>
</body>
</html>
Output
Experiment 03: Make a Home Page For Bookstore Website
Objective
The objective of this experiment is to create a Home Page for Book Store Website with NavBar
and a SideBar.
<div class="main-container">
<aside class="sidebar">
<h3>Engineering Subjects</h3>
<ul>
<li><a href="#">Computer Science</a></li>
<li><a href="#">Electrical Engineering</a></li>
<li><a href="#">Mechanical Engineering</a></li>
<li><a href="#">Civil Engineering</a></li>
<li><a href="#">Aerospace Engineering</a></li>
</ul>
</aside>
<div class="content">
<section class="welcome-section">
<h1>Welcome to IPEC Bookstore</h1>
<p>Your one-stop shop for all your academic book needs!</p>
</section>
<section class="search-bar">
<input type="text" placeholder="Search for books, authors, or ISBN...">
<button>Search</button>
</section>
<section class="features">
<h2>Our Services</h2>
<ul class="feature-list">
<li class="feature-item">
<div class="feature-icon"> </div>
<div class="feature-content">
<h3>Browse Catalog</h3>
<p>Explore our extensive collection of textbooks and reference materials.</p>
</div>
<div class="feature-action">
<button>View Catalog</button>
</div>
</li>
<li class="feature-item">
<div class="feature-icon"> </div>
<div class="feature-content">
<h3>Quick Order</h3>
<p>Know what you need? Place a quick order with minimal steps.</p>
</div>
<div class="feature-action">
<button>Order Now</button>
</div>
</li>
<li class="feature-item">
<div class="feature-icon"> </div>
<div class="feature-content">
<h3>Rental Options</h3>
<p>Save money by renting textbooks for the semester.</p>
</div>
<div class="feature-action">
<button>Rent Books</button>
</div>
</li>
</ul>
</section>
<section class="top-picks">
<h2>Top Picks</h2>
<div class="featured-books">
<div class="book-card">
<img src="assets/IntroToAlgo.jpg" alt="Introduction to Algorithms" height="200">
<h3>Introduction to Algorithms</h3>
<p>by Thomas H. Cormen</p>
<p class="price">₹1900.00</p>
</div>
<div class="book-card">
<img src="assets/ElectricCkt.jpg" alt="Electric Circuits" height="200">
<h3>Electric Circuits</h3>
<p>by Charles K. Alexandra</p>
<p class="price">₹1500.00</p>
</div>
<div class="book-card">
<img src="assets/MechMat.jpg" alt="Mechanics of Materials" height="200">
<h3>Mechanics of Materials</h3>
<p>by Barry J. Goodno</p>
<p class="price">₹1720.00</p>
</div>
<div class="book-card">
<img src="assets/StructAnal.jpg" alt="Structural Analysis" height="200">
<h3>Structural Analysis</h3>
<p>by R.C. Hibbeler</p>
<p class="price">₹1280.00</p>
</div>
</div>
</section>
<section class="assistance">
<h2>Need Assistance?</h2>
<p>Our team is here to help you find the right books for your courses.</p>
<button>Contact Support</button>
</section>
</div>
</div>
</body>
</html>
Output [Home Page]
Experiment 04: Make a Login Page For Bookstore Website
Objective
The objective of this experiment is to create a Login Page for Book Store Website with NavBar
and a SideBar.
<div class="main-container">
<aside class="sidebar">
<h3>Engineering Subjects</h3>
<ul>
<li><a href="#">Computer Science</a></li>
<li><a href="#">Electrical Engineering</a></li>
<li><a href="#">Mechanical Engineering</a></li>
<li><a href="#">Civil Engineering</a></li>
<li><a href="#">Aerospace Engineering</a></li>
</ul>
</aside>
<div class="content">
<form class="login-form">
<h2>Login</h2>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Login</button>
Objective
The objective of this experiment is to create a Registration Page for Book Store Website with
NavBar and a SideBar.
<div class="main-container">
<aside class="sidebar">
<h3>Engineering Subjects</h3>
<ul>
<li><a href="#">Computer Science</a></li>
<li><a href="#">Electrical Engineering</a></li>
<li><a href="#">Mechanical Engineering</a></li>
<li><a href="#">Civil Engineering</a></li>
<li><a href="#">Aerospace Engineering</a></li>
</ul>
</aside>
<div class="content">
<form class="registration-form">
<h2>Registration Form</h2>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label>Sex:</label>
<div class="radio-group">
<input type="radio" id="male" name="sex" value="male" required>
<label for="male">Male</label>
<input type="radio" id="female" name="sex" value="female" required>
<label for="female">Female</label>
</div>
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob" required>
<button type="submit">Register</button>
</form>
</div>
</div>
</body>
</html>
Output [Registration Page]
Experiment 06: Make a Catalogue Page For Bookstore Website
Objective
The objective of this experiment is to create a Catalogue Page for Book Store Website with
NavBar and a SideBar.
<div class="content">
<section class="catalogue-header">
<h1>Book Catalogue</h1>
<p>Browse our collection of engineering textbooks</p>
</section>
<section class="book-grid">
<div class="book-card">
<img src="assets/IntroToAlgo.jpg" alt="Introduction to Algorithms" height="200">
<h3>Introduction to Algorithms</h3>
<p>by Thomas H. Cormen</p>
<p class="price">₹1900.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/ElectricCkt.jpg" alt="Electric Circuits" height="200">
<h3>Electric Circuits</h3>
<p>by James W. Nilsson</p>
<p class="price">₹1500.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/MechMat.jpg" alt="Mechanics of Materials" height="200">
<h3>Mechanics of Materials</h3>
<p>by Russell C. Hibbeler</p>
<p class="price">₹1720.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/StructAnal.jpg" alt="Structural Analysis" height="200">
<h3>Structural Analysis</h3>
<p>by R.C. Hibbeler</p>
<p class="price">₹1280.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/DataStructAlgo.jpg" alt="Data Structures and Algorithms"
height="200">
<h3>Data Structures and Algorithms</h3>
<p>by Michael T. Goodrich</p>
<p class="price">₹1080.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/SysCtrl_.jpg" alt="Control Systems Engineering" height="200">
<h3>Control Systems Engineering</h3>
<p>by Norman S. Nise</p>
<p class="price">₹2000.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/thermo.jpg" alt="Thermodynamics: An Engineering Approach"
height="200">
<h3>Thermodynamics: An Engineering Approach</h3>
<p>by Yunus A. Cengel</p>
<p class="price">₹1660.00</p>
<button>Add to Cart</button>
</div>
<div class="book-card">
<img src="assets/fluid.jpg" alt="Fluid Mechanics" height="200">
<h3>Fluid Mechanics</h3>
<p>by Frank M. White</p>
<p class="price">₹1500.00</p>
<button>Add to Cart</button>
</div>
</section>
</div>
</div>
</body>
</html>
Output [Catalogue Page]
Code
<!-- Page1.html --> [FIRST PAGE]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CS Engineering Hub - Home</title>
<link rel="stylesheet" href="styles.css">
</head>
<body class="page1">
<header>
<h1>CS Engineering Hub</h1>
<p class="subtitle">Exploring the Frontiers of Computer Science</p>
</header>
<main>
<section class="content">
<h2>Welcome to CS Engineering Hub</h2>
<p>Dive into the fascinating world of Computer Science Engineering with us. From
algorithms to artificial intelligence, we cover the latest advancements and foundational concepts
that shape our digital world.</p>
<p>Whether you're a seasoned developer or a curious beginner, our platform offers insights,
tutorials, and resources to enhance your understanding of computer science and its
applications.</p>
</section>
<section class="content">
<h2>Featured Topics</h2>
<ul>
<li>Machine Learning and AI: Transforming Industries</li>
<li>Blockchain Technology: Beyond Cryptocurrencies</li>
<li>Quantum Computing: The Next Frontier</li>
<li>Cybersecurity: Protecting Digital Assets</li>
</ul>
</section>
</main>
<footer>
<p>Computer Science Engineering Hub</p>
<a href="page2.html">Explore Our Resources →</a>
</footer>
</body>
</html>
header h1 {
font-size: 2.5em;
text-align: center;
margin-top: 20px;
}
header .subtitle {
font-style: italic;
font-weight: 300;
text-align: center;
margin-top: 5px;
}
main {
max-width: 800px;
margin: 0 auto;
padding: 20px;
border-radius: 10px;
}
main .content h2 {
font-size: 1.8em;
margin-bottom: 10px;
}
main .content p {
font-size: 1em;
line-height: 1.6;
padding: 0 20px;
}
ul {
list-style-type: none;
padding-left: 0;
}
li {
margin-bottom: 10px;
padding-left: 20px;
position: relative;
}
li::before {
content: '>';
position: absolute;
left: 0;
font-family: monospace;
font-weight: bold;
}
footer {
text-align: center;
margin-top: 30px;
padding: 20px;
border-radius: 10px;
}
footer p {
margin-bottom: 10px;
}
a{
text-decoration: none;
font-weight: bold;
}
body.page1 header h1 {
color: #4fc3f7;
}
body.page1 main {
background-color: rgba(33, 33, 33, 0.8);
}
body.page1 a {
color: #4fc3f7;
}
body.page1 a:hover {
color: #81d4fa;
}
body.page1 li::before {
color: #4fc3f7;
}
body.page1 footer {
background-color: rgba(25, 25, 25, 0.8);
}
body.page2 header h1 {
color: #1976d2;
}
body.page2 main {
background-color: rgba(255, 255, 255, 0.8);
}
body.page2 a {
color: #1976d2;
}
body.page2 a:hover {
color: #1565c0;
}
body.page2 li::before {
color: #1976d2;
}
body.page2 footer {
background-color: rgba(240, 240, 240, 0.8);
}
Objective
Code
<!-- Space.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Background Repeat - repeat</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-image: url("https://cdn.vectorstock.com/i/1000x1000/76/13/colorful-square-
blank-background-design-vector-4007613.webp");
background-repeat: space;
background-size: 100px 100px;
background-color: #f0f8ff;
font-family: "Arial", sans-serif;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
color: #333;
}
.container {
padding: 20px;
background-color: rgb(255, 255, 255);
border-radius: 8px;
}
h1 {
color: #085454;
}
p{
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>Background Repeat: Space</h1>
<p>
The image repeats both horizontally and vertically to fill the page.
</p>
</div>
</body>
</html>
ul {
list-style: none;
padding: 0;
display: flex;
justify-content: center;
gap: 20px;
margin-top: 20px;
}
li {
display: inline-block;
}
footer {
margin-top: 30px;
text-align: center;
font-size: 0.9em;
color: #6c757d;
}
</style>
</head>
<body>
<h1>Welcome to the Stylish Link Page</h1>
<p>Click on the links below to explore different websites!</p>
<ul>
<li><a href="https://www.google.com" target="_blank">Google</a></li>
<li><a href="https://www.wikipedia.org" target="_blank">Wikipedia</a></li>
<li><a href="https://www.Youtube.com" target="_blank">Youtube</a></li>
</ul>
<footer>
Made with by a coding enthusiast.
</footer>
</body>
</html>
Output [ Space.html ]
Output [ RepeatX.html ]
Output [ RepeatY.html ]
Output [ NoRepeat.html ]
Output [ Round.html ]
Output [ Link.html ]
Experiment 10: Name & Password Validation Using JS Objective Js VALIDATION:
Write JavaScript to validate the following fields of the above registration page. 1. Name (Name
should contains alphabets and the length should not be less than 6 characters). 2. Password
(Password should not be less than 6 characters length).
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Registration Page</title>
<style>
.error {
color: red;
font-size: 14px;
}
form {
max-width: 400px;
margin: auto;
}
input {
display: block;
margin: 10px 0;
padding: 10px;
width: 100%;
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}
span {
margin-top: 10px;
}
</style>
</head>
<body>
<center>
<h1>Registration Page</h1>
</center>
<form id="registrationForm">
<label for="name">Name:</label>
<input type="text" id="name" name="name" />
<span class="error" id="nameError"></span>
<br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" />
<span class="error" id="passwordError"></span>
<br />
<button type="submit">Register</button>
</form>
<script>
document
.getElementById("registrationForm")
.addEventListener("submit", function (e) {
e.preventDefault();
const name = document.getElementById("name").value.trim();
const password = document.getElementById("password").value.trim();
const nameError = document.getElementById("nameError");
const passwordError = document.getElementById("passwordError");
nameError.textContent = "";
passwordError.textContent = "";
let isValid = true;
const namePattern = /^[A-Za-z\s]+$/;
if (name.length < 6 || !namePattern.test(name)) {
nameError.textContent =
"Name should contain only alphabets and be at least 6 characters long.";
isValid = false;
}
if (password.length < 6) {
passwordError.textContent =
"Password should be at least 6 characters long.";
isValid = false;
}
if (isValid) {
alert("Registration successful!");
}
});
</script>
</body>
</html>
Experiment 11: Email & Mobile No Validation Using JS Objective Js VALIDATION:
Write JavaScript to validate the following fields of the above registration page. 1. E-mailid (should
not contain any invalid and must follow the standard pattern([email protected]) 2. Phone
Number(Phone number should contain 10 digits only)
Code
<!-- Registration-JS.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Email and Phone Validation</title>
<style>
h1 {
margin-top: 150px;
}
.error {
color: red;
font-size: 14px;
}
form {
max-width: 400px;
margin: auto;
}
input {
display: block;
margin: 10px 0;
padding: 10px;
width: 100%;
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}
</style>
</head>
<body>
<center>
<h1>Registration Page</h1>
</center>
<form id="validationForm">
<label for="email">Email ID:</label>
<input type="text" id="email" name="email" />
<span class="error" id="emailError"></span>
<br />
<label for="phone">Phone Number:</label>
<input type="text" id="phone" name="phone" />
<span class="error" id="phoneError"></span>
<br />
<button type="submit">Validate</button>
</form>
<script src="script.js"></script>
</body>
</html>
<!-- script.js -->
document
.getElementById("validationForm")
.addEventListener("submit", function (e) {
e.preventDefault();
const email = document.getElementById("email").value.trim();
const phone = document.getElementById("phone").value.trim();
const emailError = document.getElementById("emailError");
const phoneError = document.getElementById("phoneError");
emailError.textContent = "";
phoneError.textContent = "";
let isValid = true;
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(email)) {
emailError.textContent =
"Invalid email format. Please use [email protected].";
isValid = false;
}
const phonePattern = /^\d{10}$/;
if (!phonePattern.test(phone)) {
phoneError.textContent = "Phone number must contain exactly 10 digits.";
isValid = false;
}
if (isValid) {
alert("Validation successful!");
}
});