Web Technology LabFile
Web Technology LabFile
WT Laboratory
CSX – 330
SESSION – JAN-JUN 2020
1
17109001
INDEX
S. TOPIC DATE PAGE NO REMARKS
NO
2
17109001
Practical 1
AIM: - Write HTML/JavaScript code to display your CV in browser.
About HTML:
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be
displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS)
and scripting languages such as JavaScript.
Web browsers receive HTML documents from a web server or from local storage and render the
documents into multimedia web pages. HTML describes the structure of a web page semantically
and originally included cues for the appearance of the document.
HTML elements are the building blocks of HTML pages. With HTML constructs, images and other
objects such as interactive forms may be embedded into the rendered page. HTML provides a means
to create structured documents by denoting structural semantics for text such as headings,
paragraphs, lists, links, quotes and other items. HTML elements are delineated by tags, written using
angle brackets. Tags such as <img /> and <input /> directly introduce content into the page. Other
tags such as <p> surround and provide information about document text and may include other tags
as sub-elements. Browsers do not display the HTML tags, but use them to interpret the content of the
page.
The below html code is used to display a resume. The entire code is kept under main div tag which
has been styles using internal CSS. Rest all the tags are normally used such as headings, paragraphs,
break line, table rows and columns and image tags etc.
HTML Code:-
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Resume</title>
</head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
}
th {
text-align: left;
text-decoration: underline;
}
</style>
<body>
<table cellspacing="10px" style="border: 10px solid #ff9900;padding: 5px;">
<tbody>
<tr>
<th>
<center>
<h1>RESUME</h1>
</center>
3
17109001
</th>
</tr>
<!-- BASICS -->
<tr>
<td>
<strong><u>Abhay Singh</u></strong><br>
E Mail:-<a href="mailto:[email protected]">[email protected]</a><br>
Contact No. -+91-8770724432<br>
<address>Gwalior (M.P)</address>
</td>
<td style="width: 100px;height:120px;background: url('Abhay.JPG') no-repeat center;background-size:
cover;">
<!-- <img style="width: inherit;" src="./IMG_6759.JPG"> -->
</td>
</tr>
<!-- OBJECTIVE -->
<hr>
<tr>
<th>Objective:</th>
</tr>
<tr>
<td>To associate with your vibrant organization to fully utilize my skills.
</td>
</tr>
<!-- EDUCATIONAL QUALIFICATION -->
<tr>
<th>Educational Qualification</th>
</tr>
<tr>
<td>
<table style="padding: 2px;">
<tbody>
<thead>
<tr>
<th>Course</th>
<th>Institute Name</th>
<th>Year</th>
<th>Percentage</th>
</tr>
</thead>
<tr>
<td>B.Tech</td>
<td>NIT Jalandhar</td>
<td>2021</td>
<td><a href="5TH.pdf">CGPA=8.96</a></td>
</tr>
<tr>
<td>10+2</td>
<td>Army Public School, Gwalior</td>
<td>2016</td>
<td><a href="+2Marksheet.pdf">92%</a></td>
</tr>
<tr>
<td>10<sup>th</sup></td>
<td>Army Public School, Gwalior</td>
<td>2014</td>
<td><a href="10Marksheet.pdf">CGPA-10</a></td>
</tr>
</tbody>
4
17109001
</table>
</td>
</tr>
<!-- PROFESSIONAL SKILLS -->
<tr>
<th>Professional Skills</th>
</tr>
<tr>
<td>
<ul>
<li>C++</li>
<li>Data Structures and Algorithm</li>
<li>Databases - MySQL</li>
<li>Java</li>
<li>Android</li>
</ul>
</td>
</tr>
</html>
5
17109001
View in Browser:-
6
17109001
Practical 2
AIM: - Write HTML/JavaScript code to create a static website with form.
Description:
About Static Web Pages:
Static web pages are often HTML documents stored as files in the file system and made available by
the web server over HTTP (nevertheless URLs ending with ".html" are not always static). However,
loose interpretations of the term could include web pages stored in a database, and could even
include pages formatted using a template and served through an application server, as long as the
page served is unchanging and presented essentially as stored.
Static web pages are suitable for the contents that never or rarely need to be updated, though modern
web template systems are changing this. Maintaining large numbers of static pages as files can be
impractical without automated tools, such as static site generators. Another way to manage static
pages is Online compiled source code playgrounds, e.g. GatsbyJS and GitHub may be utilized for
migrating a WordPress site into statics web pages. Any personalization or interactivity has to run
client-side, which is restricting.
Advantages of a static website
• Provide improved security over dynamic websites (dynamic websites are at risk to web shell
attacks if a vulnerability is present)
• Improved performance for end users compared to dynamic websites
• Fewer or no dependencies on systems such as databases or other application servers
• Cost savings from utilizing cloud storage, as opposed to a hosted environment
The below html code is used to display homepages and pages linked to it. The home page is a simple
page which has options to access and play audio and video file. It has an external link page
connected to it which is a form page.
Form page is a page which is used to understand various html input elements and their tags such as
button, text box, combo box, radio buttons etc.
HTML Code:-
Form.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form>
<table>
<tr>
7
17109001
<td>
<label for="uname">Name</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="uemail">Email</label>
</td>
<td>
<button type="button">Check</button>
</td>
</tr>
<tr>
<td>
<label for="age">Age</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label>Country</label>
</td>
<td>
8
17109001
</td>
</tr>
<tr>
<td>
<label for="pass">Password</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="res">Resume</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label>Hobbies</label>
</td>
<td>
<label>
</label>
<label>
9
17109001
</label>
</td>
</tr>
<tr>
<td>
<label>Gender</label>
</td>
<td>
<label>
<label>
</td>
</tr>
<tr>
<td>
<label for="city">City</label>
</td>
<td>
<optgroup label="Metros">
<option>New Delhi</option>
<option>Mumbai</option>
<option>Channai</option>
<option>Kolkata</option>
</optgroup>
<optgroup label="Others">
<option>Noida</option>
10
17109001
<option>Gurgram</option>
<option>Jalandhar</option>
<option>Bangluru</option>
</optgroup>
</select>
</td>
</tr>
<tr>
<td>
<label>Address</label>
</td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="reset">
</td>
</tr>
</table>
</form>
</body>
</html>
11
17109001
StaticWebsite.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<style>
body {
12
17109001
.header {
padding: 40px;
text-align: center;
background: #1abc9c;
color: white;
.navbar{
overflow: hidden;
background-color: #333;
.navbar a{
float: left;
display: block;
color: white;
text-align: center;
text-decoration: none;
.navbar a.right{
float: right;
*{
box-sizing: border-box;
.row {
display: flex;
flex-wrap: wrap;
.side {
13
17109001
flex: 30%;
background-color: #f1f1f1;
padding: 20px;
.main {
flex: 70%;
background-color: white;
padding: 20px;
.fakeimage {
padding: 20px;
text-align: center;
background: #ddd;
.row {
flex-direction: column;
.footer {
padding: 20px;
text-align: center;
background: #ddd;
</style>
</head>
<body>
<div class="header">
<h1>Name of college</h1>
<p>address</p>
14
17109001
</div>
<div class="navbar">
</div>
<div class="row">
<div class="side">
<h3>News</h3>
<li>news 1...</li>
<li>news 2...</li>
<li>news 3...</li>
</ul>
<h3>Photo Gallary</h3>
<h3>Contact us</h3>
<p>
Dr B R Ambedkar
</p>
15
17109001
</div>
<div class="main">
<h2>Vision</h2>
<h2>Students Corner</h2>
<li>result</li>
<li>time table</li>
<li>sitting arrangements</li>
</ul>
<h2>Placements</h2>
<li>B.tech</li>
<li>M.tech</li>
</ul>
<h2>Downloads</h2>
<li>academic calender</li>
<li>list of holidays</li>
</ul>
</div>
</div>
<div class="footer">
</div>
</body>
16
17109001
Practical 3
AIM: Create a web page that includes a map and display the related information
when a hot spot is clicked in map.
Description:
The Image
The image is inserted using the <img> tag. The only difference from other images is that you must
add a usemap attribute:
The usemap value starts with a hash tag # followed by the name of the image map, and is used to
create a relationship between the image and the image map.
The Map
Then add a <map> element.
The <map> element is used to create an image map, and is linked to the image by using the name
attribute:
<map name="workmap">
The name attribute must have the same value as the usemap attribute.
Note: You may insert the <map> element anywhere you like, it does not have to be inserted right
after the image.
17
17109001
The Areas
Then add the clickable areas.A clickable area is defined using an <area> element.
Shape
You must define the shape of the area, and you can choose one of these values:
• • rect - defines a rectangular region
• • circle - defines a circular region
• • poly - defines a polygonal region
• • default - defines the entire region
The below html code is used to display a solar system picture which is actually a HOTSPOT map.
The special feature of a hotspot map is that you link the areas on the map to different locations to
connect to it . That locations can be either photos or some other links to some other pages, and pages
linked to it. In the code on clicking on each planet’s photo on hotspot map, user navigates to another
photo which tells more about that planet.
CODE:
<html>
<head>
<title>Hotspot Map</title>
</head>
<body>
<map name="workmap">
</map>
</body>
</html>
18
17109001
View in Browser:
19
17109001
Practical 4
AIM: Create Several Frames Using HTML And display the web Browser.
You can define an inline frame with HTML tag <iframe>. The <iframe> tag is not somehow related
to <frameset> tag, instead, it can appear anywhere in your document. The <iframe> tag defines a
rectangular region within the document in which the browser can display a separate document,
including scrollbars and borders. An inline frame is used to embed another document within the
current HTML document.
The src attribute is used to specify the URL of the document that occupies the inline frame.
CODE:
<html>
<head>
<title>frame1</title>
</head>
<body>
<p>
</p>
<p>
</p>
</body>
</html>
20
17109001
<html>
<head>
</head>
<body>
</body>
</html>
View in Browser:
21
17109001
EXPERIMENT-5
AIM- Create a Scientific Calculator in HTML using JavaScript.
HTML CODE-
calculator.html
<html>
<head>
<title>CALCULATOR</title>
<style>
div
{
margin: 50px;
padding: 20px;
background-color: rgba(0, 0, 0, 0.2);
}
table
{
margin-left: auto;
margin-right: auto;
margin-bottom: 50px;
}
#data
{
height: 100%;
width: 100%;
font-size: 30px;
text-align: right;
}
td
{
height: 50px;
width: 80px;
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
text-align: center;
}
button
{
font-size: 30px;
background-color: transparent;
color: blanchedalmond;
font-family: cursive;
border: 0px;
height: 100%;
width: 100%;
}
</style>
</head>
<body style="background-color: rgb(6, 48, 58);color:
blanchedalmond;font-family: cursive;">
<div>
<p style="text-align: center;font-size: 50px;font-weight:
bold;">CALCULATOR</p>
22
17109001
<table>
<tr>
<td colspan="7" style="height: 70px;">
<input type="text" id="data" value="">
</td>
</tr>
<tr>
<td>
<button onclick="addChar('fact(', 'fact(');">x!
</button>
</td>
<td>
<button onclick="addChar('Π',
'Math.PI');">Π</button>
</td>
<td>
<button onclick="addChar('(', '(');">(</button>
</td>
<td>
<button onclick="addChar(')', ')');">)</button>
</td>
<td>
<button onclick="addChar('%', '%');">%</button>
</td>
<td>
<button onclick="clear_all()">AC</button>
</td>
<td>
<button onclick="clear_one()">CE</button>
</td>
</tr>
<tr>
<td>
<button onclick="addChar('sin(',
'Math.sin(');">sin</button>
</td>
<td>
<button onclick="addChar('cos(',
'Math.cos(');">cos</button>
</td>
<td>
<button onclick="addChar('tan(',
'Math.tan(');">tan</button>
</td>
<td>
<button onclick="addChar('7', '7');">7</button>
</td>
<td>
<button onclick="addChar('8', '8');">8</button>
</td>
<td>
<button onclick="addChar('9', '9');">9</button>
</td>
<td>
23
17109001
24
17109001
</tr>
<tr>
<td>
<button onclick="addChar('e',
'Math.E')">e</button>
</td>
<td>
<button onclick="addChar('ln(',
'Math.log(');">ln</button>
</td>
<td>
<button onclick="addChar('log(',
'Math.log10(');">log</button>
</td>
<td>
<button onclick="addChar('0', '0');">0</button>
</td>
<td>
<button onclick="addChar('.', '.');">.</button>
</td>
<td>
<button onclick="calculate()">=</button>
</td>
<td>
<button onclick="addChar('+', '+');">+</button>
</td>
</tr>
</table>
</div>
<script>
var text=document.getElementById("data");
text.value="";
var flag=false;
text.readOnly=true;
var expression="";
function addChar(ch1, ch2)
{
if(flag==true)
{
flag=false;
clear_all();
}
text.value=text.value+ch1;
expression=expression+ch2;
}
function clear_one()
{
if(text.value=="")
{
expression="";
return;
}
if(flag==true)
{
25
17109001
flag=false;
clear_all();
}
var ch=text.value.charAt(text.value.length-1);
if( (ch>='0' && ch<='9') || ch=='(' || ch==')' || ch=='.'
|| ch=='+' || ch=='-' || ch=='*' || ch=='/' || ch=='%' ||
ch.charCodeAt(0)==928)
{
text.value=text.value.slice(0, -1);
expression=expression.slice(0, -1);
}
else if(ch=='e')
{
text.value=text.value.slice(0, -1);
expression=expression.slice(0, -6);
}
else if(ch=='^')
{
text.value=text.value.slice(0, -1);
expression=expression.slice(0, -2);
}
else
{
var ch=text.value.substr(-2);
if(ch=='ln')
{
text.value=text.value.slice(0, -2);
expression=expression.slice(0, -8);
}
else
{
var ch=text.value.substr(-3);
if(ch=='log')
{
text.value=text.value.slice(0, -3);
expression=expression.slice(0, -10);
}
else if(ch=='sin' || ch=='cos' || ch=='tan')
{
var ch=text.value.substr(-6);
if(ch=='arcsin' || ch=='arccos' ||
ch=='arctan')
{
text.value=text.value.slice(0, -6);
expression=expression.slice(0, -9);
}
else
{
text.value=text.value.slice(0, -3);
expression=expression.slice(0, -8);
}
}
else
{
26
17109001
var ch=text.value.substr(-4);
if(ch=='fact')
{
text.value=text.value.slice(0, -4);
expression=expression.slice(0, -4);
}
else if(ch=='sqrt')
{
text.value=text.value.slice(0, -4);
expression=expression.slice(0, -9);
}
}
}
}
}
function clear_all()
{
text.value="";
expression="";
}
function fact(num)
{
if(num==0 || num==1)
return 1;
let p=1;
for(i=2; i<=num; ++i)
p=p*i;
return p;
}
function calculate()
{
text.value=eval(expression);
flag=true;
}
</script>
</body>
</html>
WEBPAGE-
calculator.html
27
17109001
28