Web Design Record
Web Design Record
Name :………………………………………………………..
Branch :………………………………………………………..
Semester :………………………………………………………..
02 BOX MODEL
INDEX
EXP No.: 01
DATE: LANDING PAGE
AIM:
ALGORITHM:
1. Define the document type and languages. Create a head section with meta
tags for character set, view port and style sheet link.
2. Include the CSS file “index.css”. Set the title of the page to “Landing
Page”.
3. Create the body of the document. Create a Navigation bar with a heading
and menu button.
4. Include a Navigation menu with links for home, about and signup.
Implement a Side Navigation bar for Responsiveness.
5. Use flex box to align content. Create an “about” section with boxes
containing course information.
6. Add a button for signing up. Provide contact information and additional
details.
8. Write JavaScript functions to open and close the side navigation bar.
Toggle with of the side navigation bar when the menu button is clicked.
SOURCE CODE:
INDEX.HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Landing Page</title>
</head>
<body>
<nav>
<span class="sideMenuButton"
onclick="openNavbar()">
</span>
<div class="navbar">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
</ul>
</div>
</nav>
onclick="closeNavbar()">
</a>
<a href="#">Home</a>
<a href="#">About</a>
</div>
<div class="side1">
<h1>VIIMS INSTITUTIONS</h1>
<button>
Explore More
</a>
</button>
</div>
<div class="side2">
<img src=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20220401124017/
HTML-Tutorial.png"
width="500">
</div>
</div>
<div class="content">
<div class="title">
<span><h2>Courses</h2></span>
</div>
<div class="boxes">
<div class="box">
<div class="topic">
<b>DSA </b>
</a>
</div>
<p>
topics.
</p>
</div>
<div class="box">
<div class="topic">
<b>HTML</b>
</a>
</div>
<p>
HTML stands for HyperText Markup Language. It is used
to design web pages using the markup language.
</p>
</div>
<div class="box">
<div class="topic">
<b>Javascript</b>
</a>
</div>
<p>
</p>
</div>
</div>
</div>
</section>
<div class="content">
<div class="contactMenu">
<div class="input1">
<div class="input2">
<input type="text"
</div>
<div class="label1">
<label>Your Email</label>
</div>
<div class="input2">
<input type="text"
</div>
<div class="label1">
<label>Your Password</label>
</div>
<div class="input2">
<input type="text"
</div>
<div class="button">
<button>Sign Up</button>
</div>
</div>
<div class="input3">
<div class="rightside1">
<div class="title1">
<span>
Contact Us
</span>
</div>
<div class="content1">
</div>
<div class="title1">
<span>More Information</span>
</div>
<div class="content1">
</div>
</div>
</div>
</div>
</div>
</section>
<footer>
<div class="footer">
<span>
Created By
<a href="http://viims.ac.in/"
target="_blank">
Viims Student
</a>
</span>
</div>
</footer>
<script src="main.js"></script>
</body>
</html>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
body {
background-color: white;
color: black;
background-color: white;
}
nav {
width: 100%;
height: 80px;
display: flex;
justify-content: space-between;
background-color:cornflowerblue;
nav .heading {
font-size: 30px;
font-weight: 700;
color: white;
nav ul {
display: flex;
list-style: none;
nav ul li {
border-radius: 10px;
color: black;
font-size: 20px;
font-weight: 500;
text-decoration: none;
color: white;
nav ul li:hover {
background-color: blue;
nav ul li a:hover {
color: white;
nav .sideMenuButton {
font-size: 30px;
font-weight: bolder;
cursor: pointer;
display: none;
nav .sideMenuButton {
display: flex;
nav .navbar {
display: none;
.sideNavigationBar {
.sideNavigationBar {
height: 100%;
position: fixed;
top: 0;
right: 0%;
background-color:cornflowerblue;
overflow-x: hidden;
padding-top: 60px;
display: none;
.sideNavigationBar a {
padding: 8px 8px 8px 40px;
display: block;
font-size: 25px;
font-weight: 500;
color: #d1d1d1;
transition: 0.3s;
text-decoration: none;
.sideNavigationBar a button {
border-radius: 10px;
color: cornflowerblue;
font-size: 16px;
border-style: none;
font-weight: 700;
.sideNavigationBar a:hover {
color: white;
.sideNavigationBar .closeButton {
position: absolute;
top: 10px;
right: 25px;
font-size: 20px;
margin-left: 50px;
.line {
display: flex;
justify-content: space-between;
Align-items: center;
margin: 2% 5%;
.line .side1 {
padding-right: 50px;
.side1 h1 {
font-size: 60px;
margin-bottom: 10px;
color: blue;
.side1 button {
width: 200px;
border-radius: 20px;
border-style: none;
color: black;
font-size: 17px;
font-weight: 600;
a{
text-decoration: none;
color: black;
.side2 img {
width: 350px;
.side1 h1 {
font-size: 40px;
.side1 p {
font-size: 17px;
.line {
margin-top: 80px;
}
.side1 h1 {
font-size: 35px;
.line {
flex-direction: column;
.line .side1 {
padding: 30px;
/* section */
section .topic a {
font-size: 25px;
font-weight: 500;
margin-bottom: 10px;
.about .boxes {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
text-align: center;
border-radius: 12px;
cursor: default;
/* Contact Page */
.contact {
padding: 20px;
.contact .content {
margin: 0 auto;
padding: 30px 0;
.content .title {
width: 80%;
text-align: center;
font-weight: bolder;
font-size: 40px;
.title {
margin-bottom: 30px;
margin-left: 80px;
.contactMenu {
display: flex;
justify-content: space-evenly;
.input2 {
margin-top: 10;
.label1 {
font-size: 18px;
margin-top: 8px;
margin-bottom: 8px;
font-weight: bolder;
border-radius: 13px;
padding: 6px;
.input2 input {
width: 400px;
.button {
margin-top: 12px;
margin-left: 5px;
.button button {
width: 162px;
height: 35px;
border-radius: 12px;
border-color: transparent;
.button button:hover {
background-color: blue;
button {
width: 162px;
height: 35px;
border-radius: 12px;
border-color: transparent;
button:hover {
background-color: cornflowerblue;
.rightside1 {
display: flex;
flex-direction: column;
margin-left: 300px;
.title1 {
font-size: 18px;
margin-top: 8px;
margin-bottom: 5px;
font-weight: bolder;
.content1 {
width: 450px;
margin-top: 2px;
color: grey;
}
/* Footer */
footer {
background: var(--primary-color);
padding: 15px 0;
text-align: center;
font-size: 17px;
font-weight: 400;
color: var(--white-color);
font-weight: 500;
color: var(--white-color);
text-decoration: underline;
.contactMenu {
flex-direction: column;
align-items: center;
.rightside1 {
display: flex;
flex-direction: column;
margin-left: 0px;
.content1 {
width: 100%;
margin-top: 2px;
color: grey;
.side2 img {
width: 95%;
height: 90%;
.side2 img {
width: 100%;
section .topic a {
font-size: 20px;
section .topic p {
font-size: 5px;
.about .boxes {
display: flex;
flex-direction: column;
align-items: center; }
max-width: 70%; }
function openNavbar() {
document.getElementById("sideNavigationBar")
.style.width = "50%"; }
function closeNavbar() {
document.getElementById("sideNavigationBar")
.style.width = "0%"; }
OUTPUT:
RESULT:
Thus the above program has been verified and executed successfully.
EXP No.: 02
BOX MODEL
DATE:
AIM:
To develop a box model using HTML, CSS.
ALGORITHMS:
2. This box has some space around it (50 pixels margin) and a colorful
3. The first section has big, bold black text, a purple background, and
Property."
6. Open your webpage, and you'll see a neat title and a stylish box .
SOURCE CODE:
<!DOCTYPE html>
<head>
<title>CSS Box Model</title>
<style>
.main
{
font-size:30px;
font-weight:bold;
Text-align:center;
}
.gfg
{
margin-left:50px;
border:50px solid Purple;
width:300px;
height:200px;
text-align:center;
padding:50px;
}
.gfg1
{
font-size:40px;
font-weight:bold;
color:black;
margin-top:60px;
background-color:purple;
}
.gfg2
{
font-size:20px;
font-weight:bold;
background-color:white;
}
</style>
</head>
<body>
<div class = "main">CSS Box-Model Property</div>
<div class = "gfg">
<div class = "gfg1">Welcome!!</div>
<div class = "gfg2">Web Design World</div>
</div>
</body>
</html>
OUTPUT:
RESULT:
Thus the above program has been executed and verified successfully.
EXP No.: 03
EVENT REGISTRATION FORM
DATE:
AIM:
To design and develop an event registration form using HTML and CSS.
ALGORITHMS:
SOURCE CODE:
<!DOCTYPE html>
<html lang="en">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
width: 80%;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
font-weight: bold;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea {
width: 100%;
padding: 8px;
border-radius: 4px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
</style>
<head>
<meta charset="UTF-8">
<title>Event Registration Form</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Event Registration</h1>
<form id="registrationForm">
<div class="form-group">
<label for="fullName">Full Name:</label>
<input type="text" id="fullName" name="fullName" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="phone">Phone:</label>
<input type="tel" id="phone" name="phone" required>
</div>
<div class="form-group">
<label for="attendees">Number of Attendees:</label>
<input type="number" id="attendees" name="attendees" required>
</div>
<div class="form-group">
<label for="comments">Comments:</label>
<textarea id="comments" name="comments"></textarea>
</div>
<button type="submit">Register</button>
</form>
</div>
<script src="script.js"></script>
</body>
</html>
OUTPUT:
RESULT:
Thus the above program has been executed and verified successfully.
EXP No.: 04
STICKY NAVBAR USING FLOATS AND SASS
DATE:
AIM:
To design and develop a sticky NAVBAR using floats and SASS.
ALGORITHMS:
1. Begin with <!DOCTYPE html> and <html lang="en">.
5. Include a <div> with the class "logo" for displaying the logo.
Inside <nav>, include a <ul> with a class of "nav-list"
containing several list items (<li>).
.header {
background-color: #f1f1f1;
padding: 30px;
text-align: center;
}
#navbar {
overflow: hidden;
background-color: #333;
}
#navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
#navbar a:hover {
background-color: #ddd;
color: black;
}
#navbar a.active {
background-color: #04AA6D;
color: white;
}
.content {
padding: 16px;
}
.sticky {
position: fixed;
top: 0;
width: 100%;
}
.sticky + .content {
padding-top: 60px;
}
</style>
</head>
<body>
<div class="header">
<h2>Scroll Down</h2>
<p>Scroll down to see the sticky effect.</p>
</div>
<div id="navbar">
<a class="active" href="javascript:void(0)">Home</a>
<a href="javascript:void(0)">News</a>
<a href="javascript:void(0)">Contact</a>
</div>
<div class="content">
<h3>Sticky Navigation Example</h3>
<p>The navbar will stick to the top when you reach its scroll position.</p>
<p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo,
maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam
omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum
no molestiae voluptatibus.</p>
<p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo,
maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam
omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum
no molestiae voluptatibus.</p>
</div>
<script>
window.onscroll = function() {myFunction()};
var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
function myFunction() {
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
</script>
</body>
</html>
OUTPUT:
RESULT:
Thus the above program has been verified and executed successfully.
EXP No.: 05
DEVELOPER PORTFOLIO PAGE
DATE:
AIM:
To design and develop a developer portfolio page.
ALGORITHMS:
3. Set the character set and viewport meta tags in the head.
5. Create a flex container for the main section, setting flex-wrap and
justify-content properties.
6. Style the profile and projects sections within the flex container
with specific width, margin, padding, background color, border-
radius, and box-shadow.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Developer Portfolio</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: #fff;
text-align: center;
padding: 1em;
}
section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
padding: 2em;
}
.profile {
flex: 1;
max-width: 300px;
margin: 1em;
padding: 1em;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.projects {
flex: 2;
margin: 1em;
padding: 1em;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
footer {
text-align: center;
padding: 1em;
background-color: #333;
color: #fff;}
@media (max-width: 768px) {
section {
flex-direction: column; }
}
</style>
</head>
<body>
<header>
<h1>Your Name</h1>
<p>Web Developer</p>
</header>
<section>
<div class="profile">
<h2>Profile</h2>
<p>Add your bio and other relevant information here.</p>
</div>
<div class="projects">
<h2>Projects</h2>
<!-- Add your project details and links here -->
<ul>
<li><a href="#">Project 1</a></li>
<li><a href="#">Project 2</a></li>
<li><a href="#">Project 3</a></li>
</ul>
</div>
</section>
<footer>
<p>© 2023 Your Developer Portfolio. All rights reserved.</p>
</footer>
</body>
</html>
OUTPUT:
RESULT:
Thus the above program has been executed and verified successfully.
EXP No.: 06
PRICING CARD LIST USING PLAIN CSS AND
DATE: FLEXBOX
AIM:
To design and develop pricing card list using plain css and flexbox.
ALGORITHMS:
INDEX.HTML
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Responsive Flat Pricing Card List Design - Using HTML & CSS</title>
<link rel="stylesheet"
href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">
</head>
<body>
<section class="main-container">
<div class="card-container">
<div class="pricing">
<div class="price">
<sup>$</sup>
<span>12</span>
</div>
<p>/month</p>
<span class="type">Basic</span>
</div>
<div class="card-body">
<div class="top-shape"></div>
<div class="card-content">
<ul>
</ul>
</div>
</div>
<div class="ribbon"></div>
</div>
<div class="pricing">
<div class="price">
<sup>$</sup>
<span>20</span>
</div>
<p>/month</p>
<span class="type">Pro</span>
</div>
<div class="card-body">
<div class="top-shape"></div>
<div class="card-content">
<ul>
</ul>
</div>
</div>
<div class="ribbon"></div>
</div>
<div class="pricing-card card-03">
<div class="pricing">
<div class="price">
<sup>$</sup>
<span>25</span>
</div>
<p>/month</p>
<span class="type">Premium</span>
</div>
<div class="card-body">
<div class="top-shape"></div>
<div class="card-content">
<ul>
</ul>
<button class="buy-btn">Buy Now</button>
</div>
</div>
<div class="ribbon"></div>
</div>
</div>
</section>
</body>
</html>
style.css
@import url('https://fonts.googleapis.com/css2?
family=Poppins:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?
family=Bebas+Neue&display=swap');
:root{
--card-01-color-01: #ffb200;
--card-01-color-02: #ff9700;
--card-02-color-01: #96c110;
--card-02-color-02: #80ad0a;
--card-03-color-01: #64b2f2;
--card-03-color-02: #489ed9;
--card-body-bg-color: #fff;
--text-disabled-color: #b2b2b2;
--icon-disabled-color: #ff0404;
--body-bg-color: #e5f6ff;
*{
margin: 0;
padding: 0;
box-sizing: border-box;
body{
background: var(--body-bg-color);
.main-container{
position: relative;
max-width: 900px;
min-height: 100vh;
margin-left: auto;
margin-right: auto;
padding: 0 2rem;
display: flex;
justify-content: center;
align-items: center;
.card-container{
display: grid;
width: 100%;
gap: 40px;
margin: 50px 0;
.pricing-card{
position: relative;
.card-body{
position: relative;
width: 100%;
background: var(--card-body-bg-color);
border-radius: 0 0 10px 10px;
margin-top: 60px;
.card-body .top-shape{
height: 200px;
background: var(--card-01-color-01);
background: var(--card-02-color-01);
background: var(--card-03-color-01);
.card-body .top-shape:before{
content: '';
position: absolute;
height: 200px;
background: var(--card-01-color-02);
background: var(--card-02-color-02);
background: var(--card-03-color-02);
.pricing{
z-index: 999;
font-family: var(--bebas-font);
text-align: center;
position: absolute;
width: 100%;
.price{
display: flex;
justify-content: center;
margin-bottom: 3px;
.price span{
font-size: 9em;
line-height: 100px;
.price sup{
font-size: 2em;
transform: translateY(-15px);
.pricing p{
font-family: var(--poppins-font);
font-weight: 500;
margin-bottom: 10px;
.pricing .type{
text-transform: uppercase;
font-size: 2.5em;
.card-body .card-content{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
transform: translateY(-30px);
width: 100%;
font-family: var(--poppins-font);
text-align: center;
margin-bottom: 20px;
padding: 0 20px;
list-style: none;
font-size: 0.95em;
font-weight: 500;
display: flex;
justify-content: center;
align-items: center;
line-height: 35px;
white-space: nowrap;
.card-body .card-content ul li i{
font-size: 1.9em;
margin-left: 15px;
color: var(--card-01-color-01);
color: var(--card-02-color-01);
color: var(--card-03-color-01);
color: var(--text-disabled-color);
color: var(--icon-disabled-color);
.card-content .buy-btn{
font-family: var(--bebas-font);
border: none;
outline: none;
padding: 0 28px;
border-radius: 15px;
text-transform: uppercase;
font-size: 1.9em;
cursor: pointer;
margin-bottom: 40px;
}
.card-02 .card-content .buy-btn:hover{
.ribbon{
width: 110px;
height: 110px;
position: absolute;
bottom: -10px;
left: -10px;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
.ribbon:before{
display: flex;
justify-content: center;
align-items: center;
font-family: var(--poppins-font);
font-size: 0.8em;
font-weight: 600;
position: absolute;
width: 150%;
height: 30px;
.card-01 .ribbon:before{
background: var(--card-01-color-01);
.card-02 .ribbon:before{
background: var(--card-02-color-01);
.card-03 .ribbon:before{
background: var(--card-03-color-01);
.ribbon:after{
z-index: -1;
content: '';
position: absolute;
width: 150%;
height: 30px;
.card-01 .ribbon:after{
background: var(--card-01-color-02);
.card-02 .ribbon:after{
background: var(--card-02-color-02);
.card-03 .ribbon:after{
background: var(--card-03-color-02);
.main-container{
max-width: 680px;
.pricing-card{
margin: 20px 0;
}
.main-container{
max-width: 350px;
OUTPUT:
RESULT:
Thus the above program has been executed and verified successfully.
EXP No.: 7
REGISTER FORM AND VALIDATION
DATE:
AIM:
To develop a register form and validate it using javascript and
design the forms using CSS3 and display error messages in the
HTML page.
ALGORITHMS:
1. Design a web page with a form that includes fields for username,
email, and password.
2. Use CSS to style the form, making it visually appealing and user-
friendly.
3. Write JavaScript code to validate the user inputs before submitting the
form.
4. Check if the username has at least 3 characters. Validate the email
using a simple regex pattern for a valid email format.
5. Ensure the password has at least 6 characters.
6. If any of the validation checks fail, display an error message next to
the respective input field.
7. If all inputs are valid, allow the user to submit the form.
8. Save the HTML, CSS, and JavaScript code in separate files.
9. Open the HTML file in a web browser to see and interact with the
registration form.
SOURCE CODE:
INDEX.HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
</head>
<body>
<div class="container">
<h2>Registration Form</h2>
<label for="username">Username:</label>
<label for="email">Email:</label>
<label for="password">Password:</label>
<input type="password" id="password" name="password"
placeholder="Enter your password" required>
<button type="submit">Register</button>
</form>
</div>
<script src="script.js"></script>
</body>
</html>
STYLES.CSS
body {
margin: 0;
padding: 0;
background-color: #f4f4f4;
.container {
max-width: 400px;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
form {
display: flex;
flex-direction: column;
label {
margin-bottom: 5px;
input {
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
button {
padding: 10px;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
.error {
color: #ff0000;
margin-bottom: 10px;
SCRIPT.JS
function validateForm() {
document.getElementById('usernameError').innerHTML = '';
document.getElementById('emailError').innerHTML = '';
document.getElementById('passwordError').innerHTML = '';
// Validate username
if (username.length < 3) {
document.getElementById('usernameError').innerHTML =
'Username must be at least 3 characters';
isValid = false;
// Validate email
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email)) {
isValid = false;
// Validate password
if (password.length < 6) {
document.getElementById('passwordError').innerHTML =
'Password must be at least 6 characters';
isValid = false;
return isValid;
OUTPUT:
RESULT:
ALGORITHMS:
1. Create a webpage with a space to show data. Include styles to make
it look nice.Connect a script to make it interactive.
5. When someone opens the webpage, call the function to get and
show the data.
SOURCE CODE:
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metaname="viewport"content="width=device-width, initial-scale=1.0">
<title>Sample API Data</title>
<linkrel="stylesheet"href="styles.css">
</head>
<body>
<divclass="container">
<!-- Data will be rendered here -->
</div>
<scriptsrc="script.js"></script>
</body>
</html>
STYLES.CSS
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
}
.card {
border: 1px solid #ddd;
border-radius: 5px;
padding: 20px;
width: 300px;
box-shadow: 0px4px6pxrgba(0, 0, 0, 0.1);
background-color: #fff;
}
.cardh2 {
font-size: 20px;
margin: 0;
}
.cardp {
margin: 10px0;
}
SCRIPT.JS
asyncfunctionrenderData() {
const container = document.querySelector('.container');
const data = awaitfetchData();
if (!data) {
return;
}
data.forEach(item => {
const card = document.createElement('div');
card.classList.add('card');
const title = document.createElement('h2');
title.textContent = item.title;
const body = document.createElement('p');
body.textContent = item.body;
card.appendChild(title);
card.appendChild(body);
container.appendChild(card);
});
}
// Call the renderData function to display data
renderData();
OUTPUT:
RESULT:
Thus the above program has been executed and verified successfully.
EXP No.: 9
TODO CRUD OPERATION
DATE:
AIM:
To develop a php server that Creates,Reads,Updates and Deletes TODO
and save them in MySql database.
ALGORITHM:
1. The HTML file sets up a basic webpage structure with an input field
to add tasks, a button to add tasks, and an unordered list to display
tasks.
2. The CSS file adds a bit of styling to make the Todo List look neat
and organized.
4. The function checks if the input field is not empty. If not empty, it
creates a new task item in the list with the input value.
6. Type a task in the input field. Click the "Add Task" button.
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
</head>
<body>
<ul id=:taskList”></ul>
<script src=”todo.js”></script>
</body>
</html>
Todo.css
body {
font-family:’Arial’,sans-serif;
background: #f5f5f5;
margin: 0;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
input, button {
margin-bottom: 10px;
padding: 8px;
box-sizing: border-box;
button {
background: #4CAF50;
color: #fff;
border: none;
cursor: pointer;
.completed {
text-decoration: line-through;
Todo.js
function addTask() {
if (input.value.trim() !==”) {
const li = document.createElement(‘li’);
li.textContent = input.value;
li.onclick = function () {
li.classList.toggle(‘completed’);
};
taskList.appendChild(li);
input.value = “;
OUTPUT:
RESULT:
Thus the above program has been executed and verified successfully.
EXP No.: 10
DATE: REGISTERS AND AUTHENTICATES USER SESSION
AND STORES USER DATA
AIM:
To design and develop a php server that registers and authentications user
session and stores user data in mysql databases.
ALGORITHMS:
4. index.html - This file is created for the GUI view of the login page and
5. style.css - This file is created for the attractive view of the login form.
database connectivity.
7. authentication.php - This file validates the form data with the database
SOURCE CODE:
index.html
<html>
<head>
<title>PHP login system</title>
// insert style.css file inside index.html
<link rel = "stylesheet" type = "text/css" href = "style.css">
</head>
<body>
<div id = "frm">
<h1>Login</h1>
<form name="f1" action = "authentication.php" onsubmit = "return validation
()" method = "POST">
<p>
<label> UserName: </label>
<input type = "text" id ="user" name = "user" />
</p>
<p>
<label> Password: </label>
<input type = "password" id ="pass" name = "pass" />
</p>
<p>
<input type = "submit" id = "btn" value = "Login" />
</p>
</form>
</div>
// validation for empty field
<script>
function validation()
{
var id=document.f1.user.value;
var ps=document.f1.pass.value;
if(id.length=="" && ps.length=="") {
alert("User Name and Password fields are empty");
return false;
}
else
{
if(id.length=="") {
alert("User Name is empty");
return false;
}
if (ps.length=="") {
alert("Password field is empty");
return false;
}
}
}
</script>
</body>
</html>
style.css
body{
background: #eee;
}
#frm{
border: solid gray 1px;
width:25%;
border-radius: 2px;
margin: 120px auto;
background: white;
padding: 50px;
}
#btn{
color: #fff;
background: #337ab7;
padding: 7px;
margin-left: 70%;
}
Connection.php
<?php
$host = "localhost";
$user = "root";
$password = '';
$db_name = "javatpoint";
Authentication.php
<?php
include('connection.php');
$username = $_POST['user'];
$password = $_POST['pass'];
$sql = "select *from login where username = '$username' and password = '$pa
ssword'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if($count == 1){
echo "<h1><center> Login successful </center></h1>";
}
else{
echo "<h1> Login failed. Invalid username or password.</h1>";
}
?>
OUTPUT:
we have inserted an incorrect username, so the user is unable to log in,
and it will give the login failed error.
RESULT:
Thus the program has been executed and verified successfully.