Web Technologies Practical Assignments
Web Technologies Practical Assignments
Index
S. No. Title Signature
1. Design index page of a book Titled Web Designing.
2. Create a simple HTML page to demonstrate the use of different tags.
3. Display Letter Head of your college on a web page & it must be scrolling Right to Left.
4. Create a link to move within a single page rather than to load another page.
5. Display “Name of University” using different Text formatting Tags.
6. Design Time Table of your department and highlight most important periods.
7. Use Tables to provide layout to your web page.
8. Embed Audio and Video into your web page.
9. Divide a web page vertically and display logo of your college in left pane and logo of university in
right pane.
10. Create Bio- Data of an employee
11. Design front page of a hospital with different styles.
12. Design a web page and display horizontally two different web pages at a time.
13. Write a program to create a login form. On clicking the submit button, the user should get
navigated to a profile page.
14. Write a HTML code to create a Registration Form. On submitting the form, the user should be
asked to login with the new credentials.
15. Write a HTML code to create website in your college or department and create link for Tutorial
of specific subject.
16. Write a program to perform following operations on two numbers input by the user:
1. Addition
2. Subtraction
3. Multiplication
4. Division
17. Design a program to solve quadratic equations.
18. Write a program to determine greatest number of three numbers.
19. Write a script to compute, the Average and Grade of student’s marks.
20. Design a scientific calculator and make event for each button using scripting language.
21. Write a script to check whether a number is even or odd?
22. Write a program to show whether a number is prime or not?
23. Write a program to show multiplication table of any number.
24. Write a program to find the factorial of any number.
25. Write a program to show Fibonacci Series between 0 to 74.
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>Index Page</title>
<style>
body {
font-family: 'calibri';
}
table {
width: 40%;
border: 2px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<h1 align = "center">INDEX</h1>
<table align = "center" border = "2">
<thead>
<th>S. No.</th>
<th>Title</th>
<th>Page</th>
</thead>
<tr>
<td>1.</td>
<td>INTRODUCTION TO HTML</td>
<td>1</td>
</tr>
<tr>
<td>2.</td>
<td>THE HISTORY OF HTML</td>
<td>2</td>
</tr>
<tr>
<td>3.</td>
<td>TAGS AND ATTRIBUTES</td>
<td>4</td>
</tr>
<tr>
<td>4.</td>
<td>STRUCTURE</td>
<td>10</td>
</tr>
<tr>
<td>5.</td>
<td>TEXT</td>
<td>12</td>
</tr>
<tr>
<td>6.</td>
<td>LISTS</td>
<td>13</td>
</tr>
Roll No: Name:
Subject: Web Technologies 3
<tr>
<td>7.</td>
<td>LINKS</td>
<td>16</td>
</tr>
<tr>
<td>8.</td>
<td>IMAGES</td>
<td>18</td>
</tr>
<tr>
<td>9.</td>
<td>TABLES</td>
<td>20</td>
</tr>
<tr>
<td>10.</td>
<td>FORMS</td>
<td>26</td>
</tr>
<tr>
<td>11.</td>
<td>EXTRA MARKUP</td>
<td>30</td>
</tr>
<tr>
<td>12.</td>
<td>FLASH,VIDEO AND AUDIO</td>
<td>33</td>
</tr>
<tr>
<td>13.</td>
<td>INTRODUCING CSS</td>
<td>45</td>
</tr>
<tr>
<td>14.</td>
<td>COLOR</td>
<td>49</td>
</tr>
<tr>
<td>15.</td>
<td>TEXT</td>
<td>51</td>
</tr>
<tr>
<td>16.</td>
<td>BOXES</td>
<td>55</td>
</tr>
<tr>
<td>17.</td>
<td>LISTS,TABLES AND FORMS</td>
<td>57</td>
</tr>
<tr>
<td>18.</td>
<td>LAYOUT</td>
<td>67</td>
</tr>
Roll No: Name:
Subject: Web Technologies 4
<tr>
<td>19.</td>
<td>IMAGES</td>
<td>70</td>
</tr>
<tr>
<td>20.</td>
<td>HTMLS LAYOUT</td>
<td>72</td>
</tr>
<tr>
<td>21.</td>
<td>PROCESS AND DESIGN</td>
<td>74</td>
</tr>
<tr>
<td>22.</td>
<td>PRACTICAL INFORMATION</td>
<td>78</td>
</tr>
</table>
</body>
</html>
Output
HTML Markup
<!DOCTYPE html>
<html>
<!--Head Tag: Contains Information about HTML Document-->
<head>
<!--Title Tag: Shows Title on Browser Tab-->
<title>Basic HTML Tags</title>
<!--Heading Tags-->
<h1>Heading 1, Font Size: 2em</h1>
<h2>Heading 2, Font Size: 1.5em</h2>
<h3>Heading 3, Font Size: 1.17em</h3>
<h4>Heading 4, Font Size: 1em</h4>
<h5>Heading 5, Font Size: .83em</h5>
<h6>Heading 6, Font Size: .67em</h6>
<!--Paragraph Tag-->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque id velit
dictum, fringilla velit quis, tristique ante. Praesent lacinia, augue lacinia sollicitudin
cursus, risus lacus varius lacus, non consequat lectus dolor quis lorem. Vivamus lorem
risus, varius in arcu eu, pharetra blandit ligula. Cras dui dolor, sollicitudin a posuere
et, maximus sed sem. Aenean commodo sollicitudin enim in tincidunt. Vestibulum quis mauris
tempor, volutpat lectus tristique, vestibulum orci. Fusce pulvinar cursus est, ac blandit
enim facilisis quis. Etiam arcu odio, vestibulum at pellentesque ac, fermentum non nibh.
Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam nec facilisis tortor.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra tellus blandit,
placerat velit sed, dapibus augue.</p>
Output
Program 3: Display Letter Head of your college on a web page & it must be scrolling Right to Left.
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>LETTERHEAD DISPLAY</title>
<style type="text/css">
div {
background: linear-gradient(to left,white, #4db8ff);
height:80px;
text-align: right;
color: white;
margin: 20px 0 0 10px;
z-index: -1;
}
</style>
</head>
<body>
<img src = "https://uploads.sarvgyan.com/2018/03/CGC-Landran.jpg" style =
"position: fixed; margin-left: 10px; margin-top: -10px; z-index: 1;" height="100px"
width="60px" >
<div>
<marquee><p align = "center">
<b>Chandigarh Group of Colleges</b><br>
Transforming Education, Transforming Lives.
</p></marquee>
</div>
</body>
</html>
Program 4: Create a link to move within a single page rather than to load another page.
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>Same Page Link</title>
</head>
<main>
<h3 id = "Seasonal">Seasonal Dishes</h3>
<ul>
<li>Sarson Ka Saag</li>
<li>Kulle Ki Chaat</li>
<li>Dal Ke Paranthe</li>
<li>Kandalee Ka Saag</li>
</ul>
<h3 id = "Desserts">Desserts</h3>
<ul>
<li>Ghewar</li>
<li>Gond Ke Laddo</li>
<li>Gajar Ka Halwa</li>
<li>Alsi Ke Ladoo</li>
</ul>
Output
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>FORMATTING TAGS</title>
</head>
Output
Program 6: Design Time Table of your department and highlight most important periods.
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>MCA 2A | Time Table</title>
<style>
body {
font-family: Calibri;
}
table {
border: 3px solid black;
margin-left: auto;
margin-right: auto;
}
th, tr, td {
border: 1px solid black;
}
.Emphasis {
border: 2px solid black;
}
<body>
<main>
Roll No: Name:
Subject: Web Technologies 10
<table>
<tbody>
<!--Heading-->
<tr>
<th colspan="9">MCA 2A - Time Table</th>
</tr>
<!--Periods-->
<tr class = "Emphasis">
<th rowspan="2" class = "Emphasis">Period/Day Time</th>
<th class = "Emphasis">1st</th>
<th class = "Emphasis">2nd</th>
<th class = "Emphasis">3rd</th>
<th class = "Emphasis">4th</th>
<th class = "Emphasis">5th</th>
<th class = "Emphasis">6th</th>
<th class = "Emphasis">7th</th>
<th class = "Emphasis">8th</th>
</tr>
<!--Period Times-->
<tr class = "Emphasis">
<th class = "Emphasis">09:15 - 10:10</th>
<th class = "Emphasis">10:10 - 11:05</th>
<th class = "Emphasis">11:05 - 12:00</th>
<th class = "Emphasis">12:00 - 12:55</th>
<th class = "Emphasis">12:55 - 01:50</th>
<th class = "Emphasis">01:50 - 02:45</th>
<th class = "Emphasis">02:45 - 03:40</th>
<th class = "Emphasis">03:40 - 04:35</th>
</tr>
<!--Monday-->
<tr>
<th class = "Emphasis">Monday</th>
<td bgcolor= "yellow">Ad. Java</td>
<td>IS</td>
<td bgcolor= "yellow">Tech.</td>
<td bgcolor= "yellow">DAA</td>
<th rowspan="8" class = "Emphasis">Lunch</td>
<td>Soft Skills</td>
<td>WT</td>
<td></td>
</tr>
<!--Tuesday-->
<tr>
<th class = "Emphasis">Tuesday</th>
<td>Apti.</td>
<td bgcolor= "yellow">DAA</td>
<td>Linux</td>
<td>WT</td>
Roll No: Name:
Subject: Web Technologies 11
<td colspan="2" bgcolor= "yellow">A2 - Advanced Java Lab 7</td>
<td></td>
</tr>
<!--Wednesday-->
<tr>
<th rowspan="2" class = "Emphasis">Wednesday</th>
<td rowspan="2" bgcolor= "yellow">Ad. Java</td>
<td rowspan="2">Apptitude</td>
<td rowspan="2">Linux</td>
<td rowspan="2" bgcolor= "yellow">Tech.</td>
<td rowspan="2">Soft Skills</td>
<td bgcolor= "yellow">A1 - WT Lab 9</td>
<td rowspan="2"></td>
</tr>
<tr>
<td>A2 - Library</td>
</tr>
<!--Thursday-->
<tr>
<th rowspan="2" class = "Emphasis">Thursday</th>
<td rowspan="2">Linux</td>
<td>A1 - Linux Lab</td>
<td bgcolor= "yellow">A2 - WT Lab 9</td>
<td rowspan="2" bgcolor= "yellow">Ad. Java</td>
<td rowspan="2">IS</td>
<td rowspan="2"></td>
<td rowspan="2"></td>
</tr>
<tr>
<td>A2 - Library</td>
<td>A1 - Library</td>
</tr>
<!--Friday-->
<tr>
<th rowspan="2" class = "Emphasis">Friday</th>
<td rowspan="2">IS</td>
<td rowspan="2" bgcolor= "yellow">DAA</td>
<td rowspan="2">WT</td>
<td rowspan="2" bgcolor= "yellow">Ad. Java</td>
<td rowspan="2">Linux</td>
<td colspan="2" bgcolor= "yellow">A1 - Ad. Java Lab 7</td>
</tr>
<tr>
<td colspan="2">A2 - Linux Lab</td>
</tr>
</tbody>
Roll No: Name:
Subject: Web Technologies 12
</table>
</main>
</body>
</html>
Output
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>Table Layout Example</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
td {
padding: 10px;
}
.sidebar {
width: 25%;
vertical-align: top;
}
.main-content {
width: 75%;
vertical-align: top;
}
</style>
</head>
<body style = "font-family: 'calibri';">
<table>
<thead>
<td colspan = "2" align = "center">
<img src = "https://s3-us-west-
2.amazonaws.com/issuewireassets/primg/54371/chandigarh-group-of-colleges-
landran1865648758.png" width = "300px">
</td>
</thead>
<tr>
<td class="sidebar">
<h3>Quicklinks</h3>
<a>Results</a><br>
Roll No: Name:
Subject: Web Technologies 13
<a>Admissions</a><br>
<a>Departments</a><br>
<a>Announcements</a><br>
</td>
<td class="main-content">
<h2>Chandigarh Group of Colleges Landran</h2>
<img src = "https://www.cgc.edu.in/public/images/common-
pages/amenities/lively-campus.jpg">
<p>Chandigarh Group of Colleges, Landran has become a synonym to
excellence. Situated on the National Highway 205A, Chandigarh Group of Colleges bespeaks
A-class educational facilities. CGC, Landran has come a long way in the field of
education. In the year 2001, it got incepted with a hope to bridge the gap between
inquisitive minds and education. Initially, Engineering was the flagship program at CGC,
Landran and with time, more & more programs got added to the curriculum. Currently, the
college offers 45+ programs under seven domains namely Engineering, Biotechnology,
Computer Application, Management, Education, Pharmacy, Commerce, Design, Bachelor of
Science and Hotel Management</p>
</td>
</tr>
</table>
</body>
</html>
Output
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>Audio & Video Example</title>
</head>
<h3>This is a Video</h3>
<video controls>
<source src = "/On&On.mp4" type = "video/mp4">
Your Browser does not Support Video Element
</video>
</body>
</html>
Output
Program 9: Divide a web page vertically and display logo of your college in left pane and logo of university in right pane.
HTML Markup
<!DOCTYEP html>
<html>
<head>
<title>College & University</title>
<style>
#OuterBox {
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
}
.logo {
max-width: 50%;
max-height: 50%;
margin: auto;
}
</style>
</head>
<body>
<div id = "OuterBox">
<div class = "Column">
<img src = "https://s3-us-west-
2.amazonaws.com/issuewireassets/primg/54371/chandigarh-group-of-colleges-
landran1865648758.png" alt = "College Logo" width = "250px" class = "Logo">
</div>
Output
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>Employee Data</title>
</head>
<body>
<table id = "EmployeeData" Border = "2px" align = "Center">
<!--Heading-->
<thead>
<tbody>
<!--Employee Photo-->
<tr>
<td colspan= "2"><img src = "erenpfp.jpg" alt = "Profile Photo" width
= "250px"></td>
</tr>
<!--Employee Information-->
<tr>
<td><b>Name</b></td>
<td>Eren Yeager</td>
</tr>
<tr>
<td><b>Age</b></td>
<td>19</td>
</tr>
<tr>
<td><b>Species</b></td>
<td>Human/Intelligent Titan</td>
</tr>
<tr>
<td><b>Rank</b></td>
<td>Soldier</td>
</tr>
<tr>
<td><b>Squad</b></td>
<td>Levi's Squad</td>
</tr>
<tr>
<td><b>Residence</b></td>
<td>Wall Rose</td>
</tr>
</tbody>
</table>
</body>
</html>
Output
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>The Hospital</title>
<style>
body {
margin: 0 20% 0 20%;
font-family: "Century Gothic";
}
.Title {
text-align: center;
font-weight: bold;
}
.NavItem {
margin: 0 10px 0 10px;
}
</style>
</head>
<body>
<header>
<h2 class = "Title">The Hospital</h2>
<div class = "NavBar" align = "center">
<a class = "NavItem">About</a>
<a class = "NavItem">Services</a>
<a class = "NavItem">Doctors</a>
<a class = "NavItem">Career</a>
</div>
Roll No: Name:
Subject: Web Technologies 18
</header>
<main>
<br>
<img src = "https://amritahospitals.org/wp-
content/uploads/2022/08/amritahospital-kochi-2048x845.png" width="100%">
<tbody>
<tr>
<td>
<a>Book Appointment</a><br>
<a>Consult a Doctor</a><br>
<a>Contact Cutomer Care</a><br>
<a>Order Medicines</a><br>
</td>
<td>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras
vulputate nulla eu augue ultricies, vitae laoreet augue elementum. Ut eget diam vel eros
auctor volutpat convallis at est. Mauris pulvinar euismod odio, quis gravida orci rutrum
sit amet. Duis ultrices mattis elementum. Phasellus malesuada leo id tellus blandit
placerat. Curabitur viverra nunc eros, a rhoncus eros commodo pharetra. Mauris molestie
quis purus vitae molestie.
Cras eu urna gravida, feugiat diam ac, dictum metus. Praesent quis feugiat leo, et viverra
sem. Proin sodales ut risus at elementum. Nunc non velit sit amet nisl finibus semper at
in urna. Maecenas et dictum ante. Nullam vulputate ante sed urna facilisis, quis efficitur
arcu lobortis. Sed rutrum turpis nec aliquet condimentum. Maecenas odio nisl, convallis a
tempor ac, lacinia nec sapien. Nulla a consequat sem, sed mattis nisi. Quisque dui eros,
malesuada ut magna a, commodo consectetur tortor. Ut ac quam magna. Ut maximus a nisl vel
tincidunt. Ut euismod accumsan orci ut faucibus. Nam ac felis nisl. Aliquam erat
volutpat. </td>
</tr>
</tbody>
</table>
</main>
</body>
</html>
Output
Program 12: Design a web page and display horizontally two different web pages at a time.
HTML Markup
<!DOCTYPE html>
<html>
<head>
<title>Two Web Pages Horizontally</title>
<style>
.container {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.frame {
width: 49%;
height: 800px;
}
</style>
</head>
<body>
<div class = "container">
<iframe class = "frame" src = "https://www.example1.com/"></iframe>
<iframe class = "frame" src = "https://www.example2.com/"></iframe>
</div>
</body>
</html>
Output
Program 13: Write a program to create a login form. On clicking the submit button, the user should get navigated to a
profile page.
<html>
<head>
<title>Student Login</title>
</head>
<br><br>
<!--Password-->
<label for = "Password">Password</label>  
<input type = "password" id = "Password">
<br><br>
<html>
<head>
<title>Welcome User</title>
</head>
Program 14: Write a HTML code to create a Registration Form. On submitting the form, the user should be asked to login
with the new credentials.
<html>
<head>
<title>Register User</title>
<style>
input {
border: 1px solid black;
border-radius: 10px;
height: 30px;
width: 100%;
padding: 0 20px 0 20px;
margin-left: 20px;
font-family: "calibri";
font-size: 15px;
}
#submit {
width: 50%;
background-color: black;
color: white;
font-weight: bold;
}
a {
color: black;
Roll No: Name:
Subject: Web Technologies 22
}
</style>
</head>
<tr>
<td>First Name</td>
<td><input type = "text" id = "FirstName"></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type = "text" id = "LastName"></td>
</tr>
<tr>
<td>Date of Birth</td>
<td><input type = "date" id = "DOB"></td>
</tr>
<tr>
<td>Username</td>
<td><input type = "text" id = "Username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type = "password" id = "Password"></td>
</tr>
<tr>
<td colspan = "2" align = "center">
<br>Already have an Account? <a href = "login.html">Login
Here</a><br><br>
<input type = "submit" id = "submit">
</td>
</tr>
</table></form>
</body>
</html>
<html>
<head>
<title>Login</title>
<style>
input {
border: 1px solid black;
border-radius: 10px;
height: 30px;
width: 100%;
padding: 0 20px 0 20px;
margin-left: 20px;
font-family: "calibri";
font-size: 15px;
}
#submit {
width: 50%;
background-color: black;
color: white;
font-weight: bold;
}
a {
color: black;
}
</style>
</head>
<tr>
Roll No: Name:
Subject: Web Technologies 24
<td>Username</td>
<td><input type = "text" id = "Username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type = "password" id = "Password"></td>
</tr>
<tr>
<td colspan = "2" align = "center">
<br>Don't have an Account? <a href = "register.html">Register
Here</a><br><br>
<input type = "submit" id = "submit" value = "Login">
</td>
</tr>
</table></form>
</body>
</html>
Program 15: Write a HTML code to create website in your college or department and create link for Tutorial of specific
subject.
HTML Markup
<!DOCTYPE html>
<html>
<head>
<!--Page Style-->
<title>Subject Tutorials</title>
<!--CSS Styles-->
<style>
body {
margin: 1% 20% 0 20%;
}
.MainTitle {
font-family: 'Helvetica';
font-weight: bold;
color: #006db5;
}
#submit {
height: 40px;
background-color: #006db5;
color: white;
font-weight: bold;
border: none;
padding: 0 10px 0 10px;
border-radius: 10px;
}
</style>
</head>
<body>
<header>
<img src = "https://s3-us-west-
2.amazonaws.com/issuewireassets/primg/54371/chandigarh-group-of-colleges-
landran1865648758.png" alt = "CGC Logo" width = "200px">
</header>
<main>
<h2 class = "MainTitle" align = "Center">Department of Computer
Applications</h2>
<p class = "MainText">From programming to web development, from cyber security
to AI, CGC Landran and its Department of Computer Applicationoffers tech-based learning in
its programs to makes student a tech expert. DCA offers a veriety of courses such as BCA,
MCA, B.Sc. Graphic & Web Designing, B.Sc. Cyber Security, etc that helps student to excel
on ever expanding world of tech.<br><br>
This page is specifically designed to provide a video based learning to
students. These can be user to review lectures, revise covered topics or cover up for
absents or leaves.</p>
<table>
<tr>
<td width = "30%"><h4 class = "MainTitle">Most Visited
Tutorials</h4></td>
<td><h4 class = "MainTitle">Get Your Tutorial</h4></td>
</tr>
<tr>
<td width = "30%">
<a href="#">Data Structured and Algorithms</a><br>
<a href="#">Advanced Java</a><br>
<a href="#">Web Designing Fundamentals</a><br>
<a href="#">Programming in C/C++</a><br>
<a href="#">Deep Learning</a>
</td>
<td>
<table>
<tr class = "MainText">
<td>
<label for = "Course">Select Course:</label><br>
<select name = "Course" id = "Course">
<option value = "0">Please
Select......................</option>
<td>
<label for = "Semester">Select Semester:</label><br>
<select name = "Semester" id = "Semester">
<option value = "0">Please
Select......................</option>
<option value = "1">First Semester</option>
<option value = "2">Second Semester</option>
<option value = "3">Third Semester</option>
<option value = "4">Fourth Semester</option>
<option value = "5">Fifth Semester</option>
<option value = "6">Sixth Semester</option>
</select>  
</td>
<td>
<label for = "Course">Select Subject:</label><br>
<select name = "Subject" id = "Subject">
<option value = "0">Please
Select......................</option>
<option value = "1">First Subject</option>
<option value = "2">Second Subject</option>
<option value = "3">Third Subject</option>
<option value = "4">Fourth Subject</option>
<option value = "5">Fifth Subject</option>
</select>
</td>
</tr>
<tr>
<td colspan = "3" align = "center"><form action =
"tutorial.html">
<br><input type = "submit" id = "submit" value = "Get
Tutorial">
</form></td>
</tr>
</table>
</td>
</tr>
</table>
</main>
</body>
</html>
Output
Program 16: Write a program to perform following operations on two numbers input by the user:
1. Addition
2. Subtraction
3. Multiplication
4. Division
<html>
<head>
<title>Calculator</title>
<script>
function Calculate() {
let Num1, Num2, Operation, Result;
Num1 = parseFloat(document.getElementById("Text1").value);
Num2 = parseFloat(document.getElementById("Text2").value);
Operation = document.getElementById("Operation").value;
if (Operation == "+") {
Result = Num1 + Num2;
} else if (Operation == "-") {
Result = Num1 - Num2;
} else if (Operation == "*") {
Result = Num1 * Num2;
} else if (Operation == "/") {
Result = Num1 / Num2;
}
document.getElementById("Display").value = Result;
}
</script>
</head>
<body>
<table align = "Center">
<tr>
<td colspan="2"><input type = "text" id = "Display"></td>
</tr>
<tr>
<td>Number 1</td>
<td><input type="text" id = "Text1" class = "Input"></td>
</tr>
<tr>
<td>Number 2</td>
<td><input type="text" id = "Text2" class = "Input"></td>
</tr>
<tr>
<td>Operation</td>
<td>
<select id = "Operation" class = "Input">
<option value = "0">Please Select</option>
<option value = "+">Addition</option>
<option value = "-">Subtraction</option>
<option value = "*">Multiplication</option>
<option value = "/">Division</option>
</select>
</td>
</tr>
<tr>
<td colspan = "2" align = "Center">
<br><button onclick = Calculate()>Calculate</button>
</td>
</tr>
</table>
</body>
</html>
Output
<html>
<head>
<title>Quadratic Equation Solver</title>
<script>
function solveQuadraticEquation() {
// Get input values
let a = parseFloat(document.getElementById("Num1").value);
let b = parseFloat(document.getElementById("Num2").value);
let c = parseFloat(document.getElementById("Num3").value);
// Calculate discriminant
let discriminant = Math.pow(b, 2) - 4 * a * c;
// Calculate roots
let root1 = (-b + Math.sqrt(discriminant)) / (2 * a);
let root2 = (-b - Math.sqrt(discriminant)) / (2 * a);
// Display roots
document.getElementById("Root1").value = root1;
document.getElementById("Root2").value = root2;
}
</script>
</head>
Output
<html>
<head>
<title>Gretest Number Finder</title>
<script>
function findGreatest() {
// Get User input
let Num1, Num2, Num3, Result;
Num1 = parseFloat(document.getElementById("Num1").value);
Num2 = parseFloat(document.getElementById("Num2").value);
Num3 = parseFloat(document.getElementById("Num3").value);
// Compare Numbers
if (Num1 > Num2 && Num1 > Num3) {
Result = Num1 + " is Largest";
} else if (Num2 > Num1 && Num2 > Num3) {
Result = Num2 + " is Largest";
} else if (Num3 > Num1 && Num3 > Num2) {
Result = Num3 + " is Largest";
}
// Show Result
document.getElementById("Display").innerText = Result;
}
</script>
</head>
<p><label id = "Display"></label></p>
Output
Program 19: Write a script to compute, the Average and Grade of student’s marks.
<html>
<head>
<title>Grade Calculator</title>
<script>
function findGrades() {
// Get User Inputs
let Sub1, Sub2, Sub3, Sub4, Sub5, Avarage, Grade;
Sub1 = parseFloat(document.getElementById("sub1").value);
Sub2 = parseFloat(document.getElementById("sub2").value);
Sub3 = parseFloat(document.getElementById("sub3").value);
Sub4 = parseFloat(document.getElementById("sub4").value);
Sub5 = parseFloat(document.getElementById("sub5").value);
<tr>
<td>Subject #1</td>
<td><input type = "number" step = "any" id = "sub1"></td>
</tr>
<tr>
<td>Subject #2</td>
<td><input type = "number" step = "any" id = "sub2"></td>
</tr>
<tr>
<td>Subject #3</td>
<td><input type = "number" step = "any" id = "sub3"></td>
</tr>
<tr>
<td>Subject #4</td>
<td><input type = "number" step = "any" id = "sub4"></td>
</tr>
<tr>
<td>Subject #5</td>
<td><input type = "number" step = "any" id = "sub5"></td>
</tr>
<tr>
<td colspan = "2"><b>
<label id = "Avarage"></label>  
<label id = "Grade"></label>
</b></td>
</tr>
Output
Program 20: Design a scientific calculator and make event for each button using scripting language.
<html>
<head>
<title>Scientific Calculator</title>
<style>
.calculator {
border: 1px solid black;
width: 220px;
padding: 10px;
}
.row {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
.btn {
width: 40px;
}
</style>
<script>
function insert(value) {
document.getElementById("display").value += value;
}
function clearDisplay() {
document.getElementById("display").value = "";
}
function backspace() {
let displayValue = document.getElementById("display").value;
document.getElementById("display").value = displayValue.substring(0,
displayValue.length - 1);
}
function calculate() {
Roll No: Name:
Subject: Web Technologies 34
let displayValue = document.getElementById("display").value;
let result = eval(displayValue);
document.getElementById("display").value = result;
}
</script>
</head>
<div class="row">
<button class="btn" onclick="clearDisplay()">C</button>
<button class="btn" onclick="backspace()">←</button>
<button class="btn" onclick="insert('^')">^</button>
<button class="btn" onclick="insert('%')">%</button>
</div>
<div class="row">
<button class="btn" onclick="insert('7')">7</button>
<button class="btn" onclick="insert('8')">8</button>
<button class="btn" onclick="insert('9')">9</button>
<button class="btn" onclick="insert('/')">/</button>
</div>
<div class="row">
<button class="btn" onclick="insert('4')">4</button>
<button class="btn" onclick="insert('5')">5</button>
<button class="btn" onclick="insert('6')">6</button>
<button class="btn" onclick="insert('*')">*</button>
</div>
<div class="row">
<button class="btn" onclick="insert('1')">1</button>
<button class="btn" onclick="insert('2')">2</button>
<button class="btn" onclick="insert('3')">3</button>
<button class="btn" onclick="insert('-')">-</button>
</div>
<div class="row">
<button class="btn" onclick="insert('0')">0</button>
<button class="btn" onclick="insert('.')">.</button>
<button class="btn" onclick="calculate()">=</button>
<button class="btn" onclick="insert('+')">+</button>
</div>
<div class="row">
<button class="btn" onclick="insert('(')">(</button>
<button class="btn" onclick="insert(')')">)</button>
<button class="btn" onclick="insert('sin(')">sin</button>
<button class="btn" onclick="insert('cos(')">cos</button>
</div>
<div class="row">
<button class="btn" onclick="insert('tan(')">tan</button>
<button class="btn" onclick="insert('sqrt(')">√</button>
<button class="btn" onclick="insert('log(')">log</button>
<button class="btn" onclick="insert('pi')">π</button>
</div>
</div>
Roll No: Name:
Subject: Web Technologies 35
</body>
</html>
Output
<html>
<head>
<title>Odd & Even Checker</title>
<script>
function checkOddEven() {
let Number, Result;
Number = parseInt(document.getElementById("Number").value);
if (Number % 2 == 0) {
Result = "Even";
} else {
Result = "Odd";
}
Output
<html>
<head>
<title>Prime Number Checker</title>
<script>
function checkPrime() {
let Number, Result;
Number = parseInt(document.getElementById("Number").value);
Output
<html>
<head>
<title>Multiplication Table</title>
<style>
table, th, td {
border: 1px solid black;
padding: 10px;
border-collapse: collapse;
}
</style>
</head>
<script>
function generateTable() {
let num = document.getElementById("num").value;
let table = document.getElementById("table");
table.innerHTML = "";
for (let i = 1; i <= 10; i++) {
let row = table.insertRow();
let cell1 = row.insertCell();
let cell2 = row.insertCell();
cell1.innerHTML = i;
cell2.innerHTML = num + " x " + i + " = " + num * i;
}
}
</script>
</body>
</html>
Output
<html>
<head>
<title>Factorial Finder</title>
<script>
function doFactorial(Number) {
if (Number > 1) {
return Number * doFactorial(Number - 1);
} else {
return Number;
}
}
function findFactorial() {
let Number, Result;
Number = parseFloat(document.getElementById("Number").value);
Result = doFactorial(Number);
document.getElementById("Factorial").value = Result;
}
</script>
</head>
Output
<html>
<head>
<title>Fibonacci Generator</title>
<script>
function generateFibo() {
let t1, t2, nt, Range, Display;
Range = document.getElementById("Range").value;
t1 = 0;
t2 = 1;
document.getElementById("Display").innerHTML = t1 + " " + t2 +
" ";
t1 = t2;
t2 = nt;
}
}
</script>
</head>
Output