WT Practical File
WT Practical File
Janakpuri C-4
New Delhi- 110058
Submitted By Submitted To
Name: Aryansh Garg Mr. Ravinder S. Kajal
Enrol Number: 01014902024
BCA(H) 2024-28
Section-B, Shift- 1st
Assignment 1
List of Assignment Create your Web Page on India using various basic HTML tags.
CODE
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Discover India</title>
</head>
<body>
<header>
<h1>Welcome to India</h1>
<nav>
<ul>
<li><a href="#culture">Culture</a></li>
<li><a href="#geography">Geography</a></li>
<li><a href="#festivals">Festivals</a></li>
<li><a href="#cuisine">Cuisine</a></li>
</ul>
</nav>
</header>
<main>
<section id="culture">
<h2>Culture</h2>
<p>India has a rich and diverse cultural heritage.Virtually all regions of India have their
distinctive places of pilgrimage, local saints and folk heroes, religious festivals, and associated fairs.
There are also innumerable festivals associated with individual villages or temples or with specific
castes and cults. The most popular of the religious festivals celebrated over the greater part of India
are Vasantpanchami (generally in February, the exact date determined by the Hindu lunar calendar),
in honour of Sarasvati, the goddess of learning; Holi (February–March), a time when traditional
hierarchical relationships are forgotten and celebrants throw coloured water and powder at one
another; Dussehra (September–October), when the story of the Ramayana is reenacted; and Diwali
(Divali; October–November), a time for lighting lamps and exchanging gifts. The major secular
holidays are Independence Day (August 15) and Republic Day </p>
<img src="https://3.bp.blogspot.com/-TnJ7BBUOZa8/WrhiiNttLlI/AAAAAAAAABI/J4aUVHH2-
ukHx3PGN_6wmXODtmGDDAmBwCLcBGAs/s1600/amazinf-facts-indian-culture.jpg" alt="Indian
Culture" width="250">
</section>
<section id="geography">
<h2>Geography</h2>
<p>India is known for its varied landscapes, from mountains to beaches.India is situated north
of the equator between 8°4' north (the mainland) to 37°6' north latitude and 68°7' east to 97°25'
east longitude.[2] It is the seventh-largest country in the world, with a total area of 3,287,263 square
kilometres (1,269,219 sq mi).[3][4][5] India measures 3,214 km (1,997 mi) from north to south and
2,933 km (1,822 mi) from east to west. It has a land frontier of 15,200 km (9,445 mi) and a coastline
of 7,516.6 km (4,671 mi).<br>
On the south, India projects into and is bounded by the Indian Ocean—in particular, by the
Arabian Sea on the west, the Lakshadweep Sea to the southwest, the Bay of Bengal on the east, and
the Indian Ocean proper to the south. The Palk Strait and Gulf of Mannar separate India from Sri
Lanka to its immediate southeast, and the Maldives are some 125 kilometres (78 mi) to the south of
India's Lakshadweep Islands across the Eight Degree Channel. India's Andaman and Nicobar Islands,
some 1,200 kilometres (750 mi) southeast of the mainland, share maritime borders with Myanmar,
Thailand and Indonesia. The southernmost tip of the Indian mainland (8°4′38″N, 77°31′56″E) is just
south of Kanyakumari, while the southernmost point in India is Indira Point on Great Nicobar Island.
The northernmost point which is under Indian administration is Indira Col, Siachen Glacier.[6] India's
territorial waters extend into the sea to a distance of 12 nautical miles (13.8 mi; 22.2 km) from the
coast baseline.[7] India has the 18th largest Exclusive Economic Zone of 2,305,143 km2 (890,021 sq
mi)</p>
<img src="https://i.pinimg.com/originals/4a/fd/c0/4afdc0bdfcbd7cd042391cff2163bb29.jpg"
alt="Indian Geography" width="250">
</section>
<section id="festivals">
<h2>Festivals</h2>
</section>
<section id="cuisine">
<h2>Cuisine</h2>
<p>Indian cuisine is famous for its rich flavors and spices.Indian cuisine has shaped the history
of international relations; the spice trade between India and Europe was the primary catalyst for
Europe's Age of Discovery.[4] Spices were bought from India and traded around Europe and Asia.
Indian cuisine has influenced other cuisines across the world, especially those from Europe (Britain in
particular), the Middle East, Southern African, East Africa, Southeast Asia, North America, Mauritius,
Fiji, Oceania, and the Caribbean.
World Wildlife Fund (WWF)’s Living Planet Report released on 10 October 2024 emphasized
India’s food consumption pattern as the most sustainable among the big economies (G20
countries).</p>
<img src="https://www.pigeontravels.com/wp-content/uploads/2018/11/food-of-india.jpg"
alt="Indian Cuisine" width="250">
</section>
</main>
<footer>
</footer>
</body>
</html>
CSS
body {
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 0;
header {
background-color: #ff5722;
color: white;
padding: 20px 0;
text-align: center;
}
nav ul {
list-style-type: none;
padding: 0;
nav ul li {
display: inline;
margin: 0 15px;
nav a {
color: white;
text-decoration: none;
main {
padding: 20px;
section {
background-color: white;
margin: 20px 0;
padding: 15px;
border-radius: 5px;
section img {
max-width: 100%;
height: auto;
border-radius: 5px;
footer {
text-align: center;
padding: 10px 0;
background-color: #333;
color: white;
OUTPUT
Assignment 2
Create an Restaurant Menu That use Ordered list, Unorder List, definition list, Nested list.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>Restaurant Menu</h1>
<ul>
<li><h3>Appetizers</h3>
<ul type="circle">
<li><b>Bruschetta</b><br>
Tooasted bread topped with diced tomatotes, basil, and olive oil</li>
<li><b>Stuffed Mushrooms<br></b>Mushrooms filled with cream cheese, garlic, and
herbs</li>
</ul>
</li>
</ul>
<ul>
<li><h3>Salads</h3>
<ul type="circle">
<li><b>Greek Salad<br></b>
<li type="none"><u>Ingredients</u></li>
<ol>
<li>Feta cheese</li>
<li>Kalamata olives</li>
<li>Red onions</li>
<li>Bell peppers</li>
</ol>
<li type="none">
<li type="none"><u>Dressing</u>
<ol>
<li>OLive oil</li>
</ol></li>
</li>
</ul>
</li>
</ul>
<ul><li><h3>Main Courses</h3></li>
<ul type="circle">
</ul>
</ul>
<ul><li><h3>Desserts</h3></li>
<dl>
<dt><b>Tiramisu</b>
<dd>Warm chocolate cake with a gooey center, served with vanilla ice cream</dd></dt>
<dt><b>Cheesecake</b>
<dd>Creamy cheesecake topped with fresh strawberries</dd></dt>
</dl></ul>
</body>
</html>
OUTPUT
Assignment 3
Design a table and make use of following attributes: colspan, rowspan, thead, tbody, tfoot,
width, height, cellpadding, cellspacing etc.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Restaurant Menu</title>
<style>
table {
width: 80%;
height: auto;
border-collapse: collapse;
th, td {
padding: 10px;
text-align: left;
th {
background-color: #f2f2f2;
</style>
</head>
<body>
<thead>
<tr>
</tr>
<tr>
<th>Category</th>
<th>Description</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">Appetizers</td>
<td>Bruschetta</td>
<td>₹ 672</td>
</tr>
<tr>
<td>Stuffed Mushrooms</td>
<td>₹ 756</td>
</tr>
<tr>
<td>Calamari</td>
<td>₹ 840</td>
</tr>
<tr>
<td>Grilled Salmon</td>
<td>₹ 1,510</td>
</tr>
<tr>
<td>Chicken Alfredo</td>
<td>₹ 1,260</td>
</tr>
<tr>
<td>Vegetable Stir-fry</td>
<td>₹ 1,008</td>
</tr>
<tr>
<td rowspan="3">Desserts</td>
<td>Tiramisu</td>
<td>₹ 340</td>
</tr>
<tr>
<td>₹ 420</td>
</tr>
<tr>
<td>Cheesecake</td>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td>₹ 7,310</td>
</tr>
</tfoot>
</table>
</body>
</html>
OUTPUT
Assignment 4
Create Student registration form for admission in college.
CODE
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<div class="container">
<h1>STUDENT REGISTRATION</h1>
<form>
</select>
<label for="address">Address</label>
<button type="submit">Register</button>
</form>
</div>
</body>
</html>
CSS
body {
background-color: #def7d9;
margin: 0;
padding: 0;
.container {
width: 350px;
padding: 40px;
background-color: white;
border-radius: 10px;
h1 {
text-align: center;
color: #333;
label {
display: block;
width: 100%;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
font-size: 14px;
border-color: #007bff;
outline: none;
button {
width: 100%;
padding: 10px;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
button:hover {
background-color: #0056b3;
}
OUTPUT -
Assignment 5
Create a web page showing India's map and create hotspots on five different states and link them to
the e-Government sites of the respective states.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<map name="india">
</map>
</area>
</map>
</body>
</html>
OUTPUT
Assignment 6
Create a web page using four frames and link them to an image, web page audio and video.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Media Frames</title>
<style>
body {
display: flex;
flex-direction: column;
margin: 0;
height:2000px;
.frame {
flex: 1;
margin: 5px;
</style>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Audio</title>
</head>
<body>
<audio controls>
</audio>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Video</title>
</head>
<body>
</video>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Web Page</title>
</head>
<body>
</body>
</html>
OUTPUT
Assignment 7
Create an Iframe and write some lines before and after it.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframe Example</title>
<style>
body {
margin: 20px;
iframe {
width: 100%;
height: 400px;
</style>
</head>
<body>
<p>This section contains some text before the iframe. Below, you will see an embedded
webpage.</p>
<p>This section contains some text after the iframe. You can find more information below.</p>
</html>
OUTPUT
Assignment 8
Create 3 similar webpage with inline and internal style sheet and external style sheet and apply all
Text styling attributes.
CODE
Inline Style
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p style="font-size: 18px; font-weight: bold; color: green;"><i>This paragraph uses inline styles for
text formatting.</i></p>
<p style="font-size: 16px; color: gray; text-align: right;">Right-aligned text with inline styles.</p>
</body>
</html>
Internal Style
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
h1 {
color: orangered;
font-size: 40px;
text-align: center;
p{
font-size: 18px;
font-weight: normal;
.right-align {
text-align: right;
</style>
</head>
<body>
</body>
</html>
External Style
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1><u>External Styles</u></h1>
</body>
</html>
body {
h1 {
font-size: 40px;
text-align: center;
p{
font-size: 18px;
font-weight: normal;
.right-align {
text-align: right;
}
Assignment 9
Make a Web page that uses all the following pseudo classes. Hover, active, focus, visited.
CODE
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pseudo-Class Example</title>
</head>
<body>
<h1>PSEYDO-CLASS Example</h1>
<script>
function markVisited(event) {
event.preventDefault();
link.classList.add('visited');
</script>
</body>
</html>
CSS
body {
background-color: #f8f9fa;
margin: 0;
padding: 20px;
h1 {
text-align: center;
color: #333;
.link {
display: inline-block;
margin: 10px;
text-decoration: none;
color: white;
background-color: #007bff;
border-radius: 5px;
.link:hover {
background-color: #30db27;
.link:active {
background-color: #004085;
transform: scale(0.95);
.link:focus {
}
.visited {
background-color: #0d0d0d;
OUTPUT
Assignment 10
Create a web page that use Id and class selector.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #161515;
margin: 0;
padding: 20px;
#header {
background-color: #5fd4fb;
color: white;
padding: 15px;
text-align: center;
.content {
background-color: white;
border-radius: 5px;
padding: 20px;
margin-top: 20px;
}
.highlight {
font-weight: bold;
</style>
</head>
<body>
<div id="header">
</div>
<div class="content">
<p>This is a simple web page that demonstrates the use of ID and class selectors in CSS.</p>
</div>
</body>
</html>
OUTPUT
Assignment 11
Create separate web pages containing: 1. Container Class IL Grid III. Tables IV. Image V. Button VI.
Typography VII. Jumbotron VIII. Glyphicons.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
padding: 20px;
section {
margin-bottom: 40px;
</style>
</head>
<body>
<div class="container">
<section id="container-class">
<h1>Container Class</h1>
<section id="grid">
<h1>Grid System</h1>
<div class="row">
</div>
</section>
<section id="tables">
<h1>Tables</h1>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
</thead>
<tbody>
<tr>
<td>John Doe</td>
<td>30</td>
<td>New York</td>
</tr>
<tr>
<td>Jane Smith</td>
<td>25</td>
<td>Los Angeles</td>
</tr>
</tbody>
</table>
</section>
<section id="image">
<h1>Image Example</h1>
<img
src="https://th.bing.com/th/id/OIP.ICWzTCj6YIbZ19_6mSGsQwHaHR?rs=1&pid=ImgDetMain"
alt="Placeholder Image" class="img-fluid" width="300px">
</section>
<section id="button">
<h1>Button Example</h1>
</section>
<section id="typography">
<h1>Typography</h1>
<h2>Subheading</h2>
</section>
<section id="jumbotron">
<div class="jumbotron text-center">
<h1>Jumbotron Example</h1>
<p>This is a simple hero unit, a simple jumbotron-style component for calling extra
attention to featured content or information.</p>
</div>
</section>
<section id="glyphicons">
<h1>Icons Example</h1>
</section>
</div>
</body>
</html>
OUTPUT
Assignment 12
WAP to make use of JavaScript Operator:: I. Arithmetic Operators II. Assignment Operators III.
Comparison Operators IV. Logical Operators V. Conditional Operators VI. Type Operators VII. Bitwise
Operators.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<pre id="output"></pre>
<script>
// I. Arithmetic Operators
let a = 10;
let b = 5;
c += 5; // c = c + 5
output.innerText += `c += 5: ${c}\n`;
c -= 5; // c = c - 5
output.innerText += `c -= 5: ${c}\n`;
c *= 2; // c = c * 2
output.innerText += `c *= 2: ${c}\n`;
c /= 3; // c = c / 3
output.innerText += `c /= 3: ${c}\n\n`;
output.innerText += `(a > 0 && b > 0): ${a > 0 && b > 0}\n`; // AND
</script>
</body>
</html>
OUTPUT
Assignment 13
WAP to make use of following JavaScript Statements: i.if ii. else iii. else if iv. switch v. while vi. do
while vii. for viii. for in ix. for of.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 20px;
background-color: #21013b;
color:aliceblue;
.result {
background-color: white;
color: black;
padding: 15px;
border-radius: 5px;
margin-top: 10px;
</style>
</head>
<body>
<h2>If-Else Statements</h2>
</div>
<div class="result">
<h2>Switch Statement</h2>
</div>
<div class="result">
<h2>While Loop</h2>
</div>
<div class="result">
</div>
<div class="result">
<h2>For Loop</h2>
</div>
<div class="result">
<h2>For In Loop</h2>
</div>
<div class="result">
<h2>For Of Loop</h2>
</div>
<script>
// If-Else Statement
let ifElseResult = (num > 10) ? "greater than 10" : "10 or less";
document.getElementById("if-else-result").innerText = ifElseResult;
// Switch Statement
let dayName;
switch (day) {
document.getElementById("switch-result").innerText = dayName;
// While Loop
let count = 1;
whileResult.push(count);
count++;
// Do While Loop
count = 8;
do {
doWhileResult.push(count);
count--;
// For Loop
forResult.push(i);
// For In Loop
// For Of Loop
forOfResult.push(value);
</script>
</body>
</html>
OUTPUT
Assignment 14
WAP to show use of following object in JS. i.date ii.Math iii.string.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #f0f8ff;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
h1 {
color: #007BFF;
button {
font-size: 16px;
color: #fff;
background-color: #007BFF;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0056b3;
#output {
margin-top: 20px;
padding: 20px;
border-radius: 5px;
background-color: #fff;
width: 300px;
text-align: center;
p{
margin: 10px 0;
</style>
<script>
function showDate() {
function showMath() {
function showString() {
function displayInfo() {
output.innerHTML = `
<p><strong>Date:</strong> ${showDate()}</p>
<p><strong>Math:</strong> ${showMath()}</p>
<p><strong>String:</strong> ${showString()}</p>
`;
</script>
</head>
<body>
<div id="output"></div>
</body>
</html>
OUTPUT
Assignment 15
WAP to show use of object in JavaScript. i. By object literal ii. By instance of object directly iii. By
using object constructor.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #f4f4f4;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
h1 {
color: #4CAF50;
button {
font-size: 16px;
color: #fff;
background-color: #4CAF50;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #45a049;
#output {
margin-top: 20px;
padding: 20px;
border-radius: 5px;
background-color: #fff;
width: 300px;
text-align: center;
p{
margin: 10px 0;
</style>
<script>
// Object Literal
const carLiteral = {
make: 'Toyota',
model: 'Camry',
year: 2020,
displayInfo: function() {
};
// Instance of Object Directly
carInstance.make = 'Honda';
carInstance.model = 'Civic';
carInstance.year = 2021;
carInstance.displayInfo = function() {
};
// Object Constructor
this.make = make;
this.model = model;
this.year = year;
this.displayInfo = function() {
};
function displayCars() {
output.innerHTML = `
<h3>Car Details:</h3>
`;
}
</script>
</head>
<body>
<div id="output"></div>
</body>
</html>
OUTPUT
Assignment 16
WAP to show Validation in JavaScript.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #ebd8f2;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
h1 {
color:rgb(87, 9, 87);
form {
background-color: #fff;
padding: 20px;
border-radius: 10px;
}
input {
padding: 10px;
margin: 10px 0;
border-radius: 5px;
width: 100%;
box-sizing: border-box;
button {
font-size: 16px;
color: #fff;
background-color: #007BFF;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0056b3;
.error {
color: #d9534f;
margin-top: -10px;
margin-bottom: 10px;
font-size: 14px;
</style>
<script>
function validateForm(event) {
errorMessage.innerHTML = '';
// Validate name
valid = false;
// Validate email
valid = false;
} else if (!emailInput.value.match(emailPattern)) {
valid = false;
if (valid) {
</script>
</head>
<body>
<button type="submit">Submit</button>
</form>
</body>
</html>
OUTPUT
Assignment 17
WAP to show usage of inbuilt functions.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #cccfcf;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
h1 {
color: #0b0b0b;
button {
font-size: 16px;
color: #fff;
background-color: #0c0c0c;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #080808;
#output {
margin-top: 20px;
padding: 20px;
border-radius: 10px;
background-color: #fff;
width: 300px;
text-align: center;
p{
margin: 10px 0;
.highlight {
font-weight: bold;
color: #D95D58;
</style>
<script>
function showInbuiltFunctions() {
// Math Functions
// String Functions
// Display Results
output.innerHTML = `
`;
</script>
</head>
<body>
<div id="output"></div>
</body>
</html>
OUTPUT
Assignment 18
WAP to show usage of i. alert box ii. prompt box iii. comfirm box.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #ffe0b2;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
h1 {
color: #ff6f20;
button {
font-size: 16px;
color: #fff;
background-color: #ff6f20;
border: none;
border-radius: 5px;
cursor: pointer;
margin: 10px;
button:hover {
background-color: #ff4e00;
#output {
margin-top: 20px;
padding: 20px;
border-radius: 10px;
background-color: #fff;
width: 300px;
text-align: center;
</style>
<script>
function showAlert() {
function showPrompt() {
if (userInput) {
} else {
}
}
function showConfirm() {
if (userConfirmed) {
} else {
</script>
</head>
<body>
<div id="output"></div>
</body>
</html>
OUTPUT
Assignment 19
WAP demonstrating i. Factorial of number ii. Prime number in a range iii. Reverse number.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Math Operations</title>
</head>
<body>
<div class="container">
<h1>Math Operations</h1>
<div class="operation">
<h2>Factorial</h2>
<p id="factorialResult"></p>
</div>
<div class="operation">
<p id="primeResult"></p>
</div>
<div class="operation">
<h2>Reverse a Number</h2>
<p id="reverseResult"></p>
</div>
</div>
function calculateFactorial() {
const n = parseInt(document.getElementById('factorialInput').value);
function factorial(n) {
if (n < 0) {
return 1;
} else {
let result = 1;
result *= i;
return result;
function findPrimes() {
const start = parseInt(document.getElementById('startRange').value);
function isPrime(num) {
return true;
if (isPrime(num)) {
primes.push(num);
return primes;
function reverseNumber() {
const n = parseInt(document.getElementById('reverseInput').value);
}
</script>
</body>
</html>
OUTPUT
Assignment 20
WAP to implement event handling using i. onclick ii. mouseover iii. mouseout iv. mousein v.
doubleclick vi. Mousemove.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
background-color: #f4f4f4;
margin: 0;
padding: 20px;
.container {
max-width: 600px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 8px;
h1 {
text-align: center;
.box {
margin: 10px 0;
padding: 20px;
text-align: center;
background: #007bff;
color: white;
border-radius: 4px;
cursor: pointer;
.box:hover {
background: #0056b3;
p{
font-weight: bold;
text-align: center;
</style>
<meta charset="UTF-8">
</head>
<body>
<div class="container">
</div>
// Click event
clickBox.onclick = function() {
};
// Mouseover event
hoverBox.onmouseover = function() {
};
// Mouseout event
hoverBox.onmouseout = function() {
};
// Mouseenter event
moveBox.onmouseenter = function() {
};
// Double-click event
dblClickBox.ondblclick = function() {
};
// Mousemove event
moveBox.onmousemove = function(event) {
const x = event.clientX;
const y = event.clientY;
};
</script>
</body>
</html>
OUTPUT
Assignment 21
WAP in JavaScript to demonstrate 1. Blur ii. Focus iii. Reset iv. Submit v. Change vi. Load.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>
body {
margin: 0;
padding: 20px;
.container {
max-width: 600px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 8px;
h1 {
text-align: center;
label {
display: block;
input, select {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
button {
margin-right: 10px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
button:hover {
background: #0056b3;
p{
font-weight: bold;
text-align: center;
</style>
<div class="container">
<form id="myForm">
<label for="name">Name:</label>
<br>
<label for="email">Email:</label>
<br>
<option value="">--Select--</option>
</select>
<br>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
</div>
<script>// Get elements
// Load event
window.onload = function() {
};
// Focus event
nameInput.onfocus = function() {
};
// Blur event
nameInput.onblur = function() {
};
// Change event
selectInput.onchange = function() {
};
// Submit event
form.onsubmit = function(event) {
};
// Reset event
form.onreset = function() {
};
</script>
</body>
</html>
OUTPUT
Assignment 22
WAP to implement event handling using i. keydown ii. Keyup.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>body {
background-color: #f4f4f4;
margin: 0;
padding: 20px;
.container {
max-width: 600px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 8px;
h1 {
text-align: center;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
p{
font-weight: bold;
text-align: center;
</style>
<div class="container">
</div>
<script>
// Get elements
// Keydown event
inputField.addEventListener('keydown', function(event) {
// Keyup event
inputField.addEventListener('keyup', function(event) {
});
</script>
</body>
</html>
OUTPUT
Assignment 23
WAP to show JS can change HTML content.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>
body {
background-color: #f4f4f4;
margin: 0;
padding: 20px;
.container {
max-width: 600px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 8px;
h1 {
text-align: center;
p{
text-align: center;
font-weight: bold;
button {
display: block;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
button:hover {
background: #0056b3;
</style>
<div class="container">
</div>
<script>// Get the button and paragraph elements
changeContentButton.onclick = function() {
};
</script>
</body>
</html>
OUTPUT
Assignment 24
WAP to show JS can change HTML attribute value.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>body {
text-align: center;
background-color: #f4f4f4;
padding: 20px;
h1 {
color: #333;
button {
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0056b3;
</style>
<br>
<script>document.getElementById('changeImageButton').addEventListener('click', function() {
});
</script>
</body>
</html>
OUTPUT
Assignment 25
WAP to show JS can change HTML style.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>
body {
text-align: center;
background-color: #f4f4f4;
padding: 20px;
h1 {
color: #333;
p{
padding: 10px;
button {
padding: 10px 15px;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0056b3;
</style>
<script>
document.getElementById('changeStyleButton').addEventListener('click', function() {
});
</script>
</body>
</html>
OUTPUT
Assignment 26
WAP to show use of Window Object in JS. i. Navigation object ii. JavaScript Screen Object iii. Set-time
function.
CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>
body {
text-align: center;
background-color: #f4f4f4;
padding: 20px;
h1 {
color: #333;
div {
margin: 20px;
padding: 10px;
border-radius: 5px;
background-color: #ffffff;
}
button {
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0056b3;
</style>
<div id="navInfo"></div>
<div id="screenInfo"></div>
<script>
// Navigation Object
// Screen Object
document.getElementById('setTimeoutButton').addEventListener('click', function() {
setTimeout(() => {
}, 3000);
});
</script>
</body>
</html>
OUTPUT
Assignment 27
Create an XML file containing note as the root element and to, from, subject and body as its child
element.
CODE
XML-
<note>
<to>John Doe</to>
<from>Jane Smith</from>
<subject>Meeting Reminder</subject>
</note>
CSS -
body {
background-color: #f4f4f4;
margin: 20px;
.xml {
background-color: #fff;
border-radius: 5px;
padding: 20px;
note {
display: block;
margin-bottom: 10px;
display: block;
margin: 5px 0;
padding: 5px;
background-color: #e9ecef;
border-radius: 3px;
to {
color: #007bff;
from {
color: #28a745;
subject {
font-weight: bold;
color: #dc3545;
body {
color: #343a40;
OUTPUT
Assignment 28
Create a well-formed XML file having 5 tags-food menu, category, name, price and calories.
Food_menu is the main parent element that contains category as the child element. Category is the
parent element of name, price and calories.
CODE
XML-
<?xml version="1.0" encoding="UTF-8"?>
<food_menu>
<category>
<name>Pizza</name>
<price>12.99</price>
<calories>300</calories>
</category>
<category>
<name>Burger</name>
<price>8.99</price>
<calories>450</calories>
</category>
<category>
<name>Pasta</name>
<price>10.99</price>
<calories>400</calories>
</category>
<category>
<name>Salad</name>
<price>7.99</price>
<calories>150</calories>
</category>
<category>
<name>Sushi</name>
<price>15.99</price>
<calories>250</calories>
</category>
</food_menu>
CSS -
body {
background-color: #f4f4f4;
margin: 0;
padding: 20px;
.food-menu {
max-width: 600px;
margin: auto;
background-color: #fff;
border-radius: 5px;
padding: 20px;
.category {
padding: 10px 0;
.category:last-child {
border-bottom: none;
.name {
font-size: 1.5em;
margin: 0;
color: #333;
}
.price {
font-size: 1.2em;
color: #28a745;
margin: 5px 0;
.calories {
font-size: 1em;
color: #777;
OUTPUT
Assignment 29
WAP to display the bookstore details in XML with CSS and internal DTD.
CODE
XML-
<?xml version="1.0"?>
<!DOCTYPE books [
]>
<books>
<book>
<publisher>Publisher: wiley</publisher>
</book>
<book>
<author>Author: Ditel</author>
<publisher>Publisher: Pearson</publisher>
<edition Edition3</edition>
<price>Price: 400</price>
</book>
<book>
<price>Price: 700</price>
</book>
<book>
<author>Author: Navath</author>
<publisher>Publisher: Oxford</publisher>
<price>Price: 600</price>
</book>
<book>
<publisher>Publisher: Oxford</publisher>
<price>Price: 300</price>
</book>
</books>
CSS -
title,
author,
publisher,
edition,
price {
display: block;
font-size: 20px;
heading {
font-size: 30px;
background-color: palegreen;
display: block;
title {
font-size: 25px;
color: black;
author {
font-size: 23px;
publisher,
edition,
price {
OUTPUT
Assignment 30
Create Valid XML doc using external DTD.
CODE
DTD file:
<!ELEMENT heading (#PCDATA)>
XML file:
<?xml version="1.0"?>
<teacherdetails>
<teacher>
</teacher>
<teacher>
<age> 65 </age>
</teacher>
<teacher>
<age> 27 </age>
</teacher>
<teacher>
</teacher>
<teacher>
<age> 29 </age>
</teacher>
CSS file:
heading, name, position, course, age, salary {
display: block;
heading {
font-size: 30px;
name {
font-size: 24px;
font-size: 20px;
}
OUTPUT