Web Lab File
Web Lab File
A
PRACTICAL FILE
ON
HTML CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Saloni Aggarwal- Resume</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
body {
font-family: Arial, sans-serif;
background: rgb(255, 255, 255);
background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(51, 217, 129, 1)
100%);
}
.container {
background-color: #ffffff;
max-width: 800px;
margin: 20px auto;
padding: 30px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1,
h2,
h3 {
color: #333;
}
.info {
margin-bottom: 20px;
}
.section-title {
border-bottom: 2px solid #333;
padding-bottom: 10px;
margin-bottom: 20px;
}
.project-title {
font-size: 18px;
font-weight: bold;
margin-top: 10px;
}
.project-description {
font-size: 14px;
color: #666;
}
.project-link {
color: #007bff;
}
.award {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="info text-center">
<h1>Saloni Aggarwal</h1>
<p>Email: [email protected]</p>
<p>Mobile: +91-123-456-7890</p>
<p>Github: https://github.com/SALONI-AGGARWAL0304</p>
<p>Leetcode:https://leetcode.com/saloni_aggarwal/</p>
<p>GFG:
https://auth.geeksforgeeks.org/user/saloniaggarwaouc3/?utm_source=geeksforgeeks&utm_m
edium=my_profile&utm_campaign=auth_user </p>
</div>
<div class="section-title">
<h2>Education</h2>
</div>
<div class="education">
<p><strong>Dr B R Ambedkar National Institute of Technology, Jalandhar,
Punjab</strong></p>
<p>Bachelor of Technology (B.Tech) [Year of Admission] - Present</p>
<p>Relevant Courses: Formal Languages and Automata Theory (FLAT), Data Structures
and Algorithms (DSA),
Design and Analysis of Algorithms (DAA), Java Programming, Web Development
(DMW), Computer Networking
(CN), etc.</p>
</div>
<div class="section-title">
<h2>Skills Summary</h2>
</div>
<div class="skills">
<p><strong>Languages:</strong> C, C++, JAVA </p>
<p><strong>Coding Platforms:</strong> Leetcode, GFG, Codechef, Coding Studio</p>
<p><strong>Skills:</strong> Frontend developer </p>
<p><strong>Soft Skills:</strong> Leadership skills , Communication skills , Smart and
hard worker </p>
</div>
<div class="section-title">
<h2>Projects</h2>
</div>
<div class="projects">
<p class="project-title">HelpRight NITJ Tech</p>
<p class="project-description">Web App CSS, JavaScript, React</p>
<p><a class="project-link" href="#">HelpRight: Click Here</a></p>
<p class="project-title">MileStone</p>
<p class="project-description">Website CSS, JavaScript, Bootstrap, HTML ,
Typescript</p>
<p><a class="project-link"
href="https://astonishing-frangipane-e0ef31.netlify.app/index.html">MileStone: Click
Here</a></p>
<p class="project-title">Fokus</p>
<p class="project-description">Website CSS, JavaScript, Bootstrap, HTML ,
Typescript</p>
<p><a class="project-link"
href="ubiquitous-smakager-37ac36.netlify.apphttps://ubiquitous-smakager-37ac36.netlify.app
/">Fokus: Click Here</a></p>
</div>
<div class="section-title">
<h2>Honors and Awards</h2>
</div>
<div class="awards">
<p class="award">Ideathon 2.0 first-round qualified - Feb 2023</p>
<p class="award">Hackathon 4.0 participation - March 2023</p>
<p class="award">100+ Questions solved on LeetCode and got the January consistency
badge 2023</p>
<p class="award">300+ coding points on GFG </p>
<p class="award">Participation in Devcreate hackathon 2.0 - Sep 2022</p>
<p class="award">Participation in Devcreate hackathon - August 2021</p>
</div>
</div>
</body>
</html>
CSS CODE:
body {
font-family: Arial, sans-serif;
margin: 20px;
text-align: center;
}
h1 {
margin-bottom: 20px;
}
table {
border-collapse: collapse;
width: 70%;
margin: 0 auto;
}
td {
padding: 10px;
border: 1px solid #ccc;
}
.label {
font-weight: bold;
width: 30%;
}
WEBSITE:
2. Create a static website to display information technology page .
HTML CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IT Department - Dr. BR Ambedkar NIT</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
.sidebar {
background-color: #333;
color: #fff;
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 2rem;
box-shadow: 2px 0px 5px rgba(0, 0, 0, 0.2);
}
header {
background-color: #1e2e47;
color: #fff;
text-align: center;
padding: 2rem 0;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
}
header img {
width: 100px;
height: auto;
}
nav {
background-color: #34495e;
color: #fff;
text-align: center;
padding: 2rem 2rem;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
}
nav a {
color: #fff;
text-decoration: none;
margin: 0 1rem;
transition: color 0.3s;
transition: color 0.3s, transform 0.3s;
display: block;
padding: 1rem 0;
width: 100%;
text-align: center;
transition: color 0.3s, background-color 0.3s;
}
nav a:hover {
transform: translateY(-2px);
/* <!-- color: #1e2e47;
background-color: #1e2e47; --> */
}
.container {
margin-left: 250px;
padding: 2rem;
background-color: #f5f5f5;
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.content {
margin-top: 0;
}
h2 {
color: #1e2e47;
}
p{
color: #666;
}
footer {
background-color: #34495e;
color: #fff;
text-align: center;
padding: 1rem 0;
}
</style>
</head>
<body>
<header>
<img src="nitj.jpeg" alt="NIT Logo">
<h1>IT Department</h1>
<p>Dr. BR Ambedkar National Institute of Technology</p>
</header>
<div class="sidebar">
<img src="nitj.jpeg" alt="NIT Logo">
<nav>
<a href="#about">About Us</a>
<a href="#programs">Programs</a>
<a href="#faculty">Faculty</a>
<a href="#cybernauts">Cyber nauts</a>
<a href="#contact">Contact</a>
</nav>
</div>
<div class="container">
<section id="about" class="content">
<h2>About Us</h2>
<p>Welcome to the IT Department of Dr. BR Ambedkar NIT. We strive to
provide cutting-edge education and
research in the field of Information Technology.</p>
</section>
<section id="programs" class="content">
<h2>Programs</h2>
<p>Explore our wide range of IT programs designed to prepare students for
the challenges of the digital age.
</p>
</section>
<section id="faculty" class="content">
<h2>Faculty</h2>
<p>Meet our dedicated and experienced faculty members who are passionate
about shaping the future of IT
professionals.</p>
</section>
<section id="cybernauts" class="content">
<h2>Cyber nauts - IT Department Club</h2>
<p>Cyber nauts is a vibrant club within our IT Department that focuses on
cybersecurity, coding, and
innovation. Join us to explore the exciting world of technology together!</p>
</section>
<section id="contact" class="content">
<h2>Contact</h2>
<p>If you have any questions or inquiries, feel free to contact us at <a
href="mailto:[email protected]">[email protected]</a></p>
</section>
</div>
<footer>
<p>© 2023 IT Department - Dr. BR Ambedkar NIT</p>
</footer>
</body>
</html>
WEBSITE:
LAB-2
HTML CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<style>
#map {
height: 600px;
}
</style>
<title>Interactive World Map</title>
</head>
<body>
<div id="map"></div>
<script>
const map = L.map('map').setView([0, 0], 2);
//js code creates a leaflet map instance and sets initial
// initial view at coordinates [0,0] and zoom value to 2
// Add the OpenStreetMap tile layer
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a
href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
WEBSITE:
HTML CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="sc.css">
<title>Scientific Calculator</title>
</head>
<body>
<div class="calculator">
<div class="screen">
<input type="text" id="display" readonly>
</div>
<div class="buttons">
<button class="clear" onclick="clearDisplay()">C</button>
<button onclick="appendNumber(7)">7</button>
<button onclick="appendNumber(8)">8</button>
<button onclick="appendNumber(9)">9</button>
<button onclick="performOperation('+')">+</button>
<button onclick="appendNumber(4)">4</button>
<button onclick="appendNumber(5)">5</button>
<button onclick="appendNumber(6)">6</button>
<button onclick="performOperation('-')">-</button>
<button onclick="appendNumber(1)">1</button>
<button onclick="appendNumber(2)">2</button>
<button onclick="appendNumber(3)">3</button>
<button onclick="performOperation('*')">*</button>
<button onclick="performOperation('sqrt')">√</button>
<button onclick="appendNumber(0)">0</button>
<button onclick="performOperation('/')">/</button>
<button onclick="performOperation('sin')">sin</button>
<button onclick="performOperation('cos')">cos</button>
<button onclick="performOperation('tan')">tan</button>
<button onclick="performOperation('asin')">sin<sup>-1</sup></button>
<button onclick="performOperation('acos')">cos<sup>-1</sup></button>
<button onclick="performOperation('atan')">tan<sup>-1</sup></button>
<button class="equal" onclick="calculate()">=</button>
</div>
</div>
<script src="sc.js"></script>
</body>
</html>
CSS CODE :
.calculator {
background-color: #2c3e50;
border-radius: 10px;
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
padding: 20px;
width: 300px;
}
.clear:hover,
.equal:hover {
background-color: #c0392b;
}
.buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
margin-top: 20px;
}
button {
font-size: 20px;
padding: 15px;
border: none;
border-radius: 5px;
background-color: #3498db;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #2980b9;
}
#display {
font-size: 24px;
width: 100%;
border: none;
outline: none;
background-color: transparent;
text-align: right;
padding: 10px;
margin-bottom: 10px;
color: #ecf0f1;
}
JS CODE :
function updateDisplay() {
document.getElementById('display').value = currentInput;
}
function appendNumber(number) {
currentInput += number;
updateDisplay();
}
function performOperation(operation) {
if (currentInput !== '') {
if (firstOperand === '') {
firstOperand = currentInput;
currentInput = '';
} else {
calculate();
}
currentOperation = operation;
updateDisplay();
}
}
function calculate() {
if (currentInput !== '' && firstOperand !== '') {
let result;
const num1 = parseFloat(firstOperand);
const num2 = parseFloat(currentInput);
switch (currentOperation) {
case '+':
result = num1 + num2;
break;
case '-':
result = num1 - num2;
break;
case '*':
result = num1 * num2;
break;
case '/':
result = num1 / num2;
break;
case 'sqrt':
result = Math.sqrt(num1);
break;
case 'sin':
result = Math.sin(num1);
break;
case 'cos':
result = Math.cos(num1);
break;
case 'tan':
result = Math.tan(num1);
break;
case 'asin':
result = Math.asin(num1);
break;
case 'acos':
result = Math.acos(num1);
break;
case 'atan':
result = Math.atan(num1);
break;
default:
break;
}
currentInput = result.toString();
firstOperand = '';
currentOperation = '';
updateDisplay();
}
}
function performOperation(operation) {
if (currentInput !== '') {
if (firstOperand === '') {
firstOperand = currentInput;
currentInput = '';
} else {
calculate();
}
currentOperation = operation;
updateDisplay();
}
}
function clearDisplay() {
currentInput = '';
firstOperand = '';
currentOperation = '';
updateDisplay();
}
function calculateSquareRoot() {
if (currentInput !== '') {
const num = parseFloat(currentInput);
const result = Math.sqrt(num);
currentInput = result.toString();
updateDisplay();
}
}
updateDisplay();
WEBSITE:
LAB-3
HTML CODE(content.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>News Website</title>
</head>
<frameset rows="20%, 80%">
<frameset cols="50%, 50%">
<frame src="header.html" name="headerFrame">
<frame src="header2.html" name="headerFrame">
</frameset>
</html>
HTML CODE(header1.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>News Header</title>
<style>
/* Header styles */
body {
background-color: #101111;
color: white;
text-align: center;
padding: 10px;
margin: 0;
}
</style>
</head>
<body>
<h1>Welcome to CV</h1>
</body>
</html>
HTML CODE(header.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vertical Frame Content</title>
</head>
</html><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>News Content</title>
<style>
/* Content styles */
body {
background-color: #ecf0f1;
padding: 20px;
margin: 0;
}
h2 {
color: #3498db;
}
p{
font-size: 16px;
}
</style>
</head>
<body>
<h2>Welcome to IT website</h2>
</body>
</html
WEBSITE:
HTML CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>India Map</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<style>
/* Style the map container to cover the whole viewport */
#map {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<!-- Create a container for the map -->
<div id="map"></div>
function initMap() {
// Initialize the map to cover the whole viewport
map = L.map('map').setView([20.5937, 78.9629], 5); // Centered at India
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a
href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
function showState(state) {
// Create a popup with the image of the state
// const popupContent = `
// <strong>${state.name}</strong><br>
// <img src="${state.image}" alt="${state.name}" width="200"
height="200">
// `;
}
}
</html>
WEBSITE:
LAB-4
HTML CODE(content.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NIT J College Website</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></
script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></scrip
t>
<style>
body {
background-color: #f0f7ff; /* Light blue background */
}
header, .navbar {
background-color:#007bff; /* Blue navbar and header background */
color:black; /* White text for navbar and header */
}
/* Custom styles for the carousel */
.carousel-inner img {
width: 100%;
height: 400px;
}
.thought-of-the-day {
text-align: center;
background-color: #007bff; /* Blue background for "Thought of the Day" */
color: #fff; /* White text for "Thought of the Day" */
padding: 20px;
}
.logo {
max-width: 150px; /* Adjust the maximum width as needed */
}
</style>
</head>
<body>
<header>
<section class="upcoming-events">
<h2>Upcoming Events</h2>
<ul>
<li>
<h3>Event 1</h3>
<p>Date: September 20, 2023</p>
<p>Description: This is the description of Event 1.</p>
</li>
<li>
<h3>Event 2</h3>
<p>Date: October 5, 2023</p>
<p>Description: This is the description of Event 2.</p>
</li>
<!-- Add more events as needed -->
</ul>
</section>
<main>
<!-- Your main content goes here -->
</main>
</body>
</html>
WEBSITE:
2. Create a website to implement stop watch
HTML CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NIT J College Website</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></
script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></scrip
t>
<style>
body {
background-color: #f0f7ff; /* Light blue background */
}
header, .navbar {
background-color:; /* Blue navbar and header background */
color:black; /* White text for navbar and header */
}
/* Custom styles for the carousel */
.carousel-inner img {
width: 100%;
height: 400px;
}
.thought-of-the-day {
text-align: center;
background-color: #007bff; /* Blue background for "Thought of the Day" */
color: #fff; /* White text for "Thought of the Day" */
padding: 20px;
}
.logo {
max-width: 150px; /* Adjust the maximum width as needed */
}
</style>
</head>
<body>
<header>
<section class="upcoming-events">
<h2>Upcoming Events</h2>
<ul>
<li>
<h3>Event 1</h3>
<p>Date: September 20, 2023</p>
<p>Description: This is the description of Event 1.</p>
</li>
<li>
<h3>Event 2</h3>
<p>Date: October 5, 2023</p>
<p>Description: This is the description of Event 2.</p>
</li>
<!-- Add more events as needed -->
</ul>
</section>
<main>
<!-- Your main content goes here -->
</main>
</body>
</html>
WEBSITE:
3. Create a website to make form validataion
HTML CODE(content.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script>
function formValidation() {
var uid = document.form1.userid;
var passid = document.form1.passid;
var uname = document.form1.username;
var uadd = document.form1.address;
var uzip = document.form1.zip;
var uemail = document.form1.email;
if (userid_validation(uid, 7, 12)) {
if (userid_validation(passid, 7, 12)) {
if (allLetter(uname)) {
if (alphanumeric(uadd)) {
if (allnumeric(uzip)) {
if (ValidateEmail(uemail)) {
}
}
}
}
}
return false;
}
}
function userid_validation(uid, mx, my) {
var uid_len = uid.value.length;
if (uid_len == 0 || uid_len >= my || uid_len < mx) {
alert(
"user id should not be empty / length be between " +
mx +
" to " +
my
);
uid.focus();
return false;
}
return true;
}
function allLetter(uname) {
var letters = /^[A-Za-z]+$/;
if (uname.value.match(letters)) {
return true;
} else {
alert("Please input alphabet characters only in name ");
uname.focus();
return false;
}
}
function alphanumeric(uadd) {
var letters = /^[0-9a-zA-Z]+$/;
if (uadd.value.match(letters)) {
return true;
} else {
alert("Please input alphanumeric characters only in address");
uadd.focus();
return false;
}
}
function allnumeric(uzip) {
var numbers = /^[0-9]+$/;
if (uzip.value.match(numbers)) {
return true;
} else {
alert("Please input numeric characters only in zip code");
uzip.focus();
return false;
}
}
function ValidateEmail(uemail) {
var mailformat =
/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (uemail.value.match(mailformat)) {
return true;
} else {
alert("You have entered an invalid email address!");
uemail.focus();
return false;
}
}
</script>
</head>
<body>
<form name="form1" onsubmit="return formValidation()">
<table
width="500"
cellpadding="3"
style="border-collapse: collapse"
>
<tr>
<td>User id</td>
<td>
<input type="submit" name="submit" value="Submit" />
</td>
</tr>
</table>
</form>
</body>
</html>
WEBSITE: