HTML Practiacal Programs
HTML Practiacal Programs
<html>
<head>
<title>Text Formatting tags</title>
</head>
<body>
<h1>This is <H1></h1>
<h2>This is <H2></h2>
<h3>This is <H3></h3>
<h4>This is <H4></h4>
<h5>This is <H5></h5>
<h6>This is <H6></h6>
<p> The different programming languages
are,<br>C,C++,Java,Operating System
</p>
<pre>
<pre> tag is used to dispaly the text
in a fixed-width font,and it protects
the line break and spaces
</pre>
</body>
</html>
2. Write a HTML page for Example Café using above text formatting tags
<html>
<head>
<title>Cafe Site</title>
</head>
<body>
<h1>Irani Cafe</h1>
<h2>Near Makka Masjid</h2>
<h3>Charminar</h3>
<h4>Hyderabad</h4>
<h5>040-123456</h5>
<p>Brances:<br>Hyderabad<br>Bangalore</p>
<pre>
There are many branches of Irani cafes in
Hyderabad
</pre>
<h6>iranicafe@gmail.com</h6>
</body>
</html>
<html>
<head>
<title>Phrase Element Tags</title>
</head>
<body>
<blockqoute cite="http://www.w3schools.com/">
About W3Schools
</blockquote>
<img src="download.jpg" alt="Error">
<p><cite>W3Schools</cite>is one of the best site for basic
learners
</p>
<p><abbr title="World Wide Web Schools">W3Schools</abbr>
was originally created in 1998 by Refsnes Data, a Norwegian
software development and consulting company.</p>
<p><acronym title="World Wide Web
Schools">W3Schools</acronym> was originally created in 1998
by Refsnes Data, a Norwegian software development and
consulting company.</p>
<address>
<a href="http://www.w3schools.com">W3Schools</a></br>
Visit us at:<br>
AV College<br>
CS Deptment<br>
Hyderabad</br>
Telangana<br>
</address>
<kbd>Enlightening Lives through Education</kbd>
</body>
<html>
<head>
<title>List Example</title>
</head>
<body>
<center>
<h1>Ordered List</h1>
<ol type="A">
<li> Red</li>
<li> White</li>
<li> Blue</li>
</ol>
<h1>Unordered List</h1>
<ul type="circle">
<li>Wipro</li>
<li>IBM</li>
<li>Infosys</li>
</ul>
<h1>Definition List</h1>
<dl>
<dt>HTML</dt>
<dd>Hyper Text Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheet</dd>
</dl>
<\center>
</body>
</html>
6. Write a HTML page that displays ingredients and instruction to prepare recipes
<html>
<head>
<title>Recipe-Basic Vanilla Cake</title>
</head>
<body>
<h1>Recipe-Basic Vanilla Cake</h1>
<h2>Ingredients:</h2>
<ul>
<li>1 1/2 cup sifted cake flour</li>
<li>1 1/2 table spoon baking powder</li>
<li>1/4 table spoon salt</li>
<li>1/2 cup unsalted butter</li>
<li>1 cup sugar</li>
<html>
<head>
<title>Grouping Elements</title>
</head>
<body>
<div class="Footnotes">
<p>Welcome to <i><span style="color:green";>
<html>
<head>
<title>HTML Media</title>
</head>
<body>
<h1>Image</h1>
<img src="C:\Users\Public\Pictures\Sample
Pictures\Penguins.jpg" height="100" width="100"
alt="error"><br>
<html>
<head>
<title>Time Table</title>
</head>
<body>
<h1>TIME TABLE</h1>
<table border="2" cellspacing="3" align="center">
<tr>
<td align="center">Days/Timings</td>
<td>9:00-9:50</td>
<td>9:50-10:40</td>
<td>10:40-10:50</td>
<td>10:50-11:40</td>
<td>11:40-12:20</td>
<td>12:20-1:00</td>
<td>1:00-2:00</td>
<td>2:00-3:00</td>
</tr>
<tr>
<td align="center">Monday</td>
<td align="center" colspan=2>---CPP Lab---</td>
<td align="center">Web Technologies</td>
<td align="center" rowspan=6>B<br>r<br>e<br>a<br>k</td>
<td align="center">-------</td>
<td align="center" rowspan=6>L<br>u<br>n<br>c<br>h<br>
B<br>r<br>e<br>a<br>k</td>
<td align="center" colspan="2">Web Technologies lab</td>
</tr>
<tr>
<td align="center">Tuesday</td>
<td align="center" colspan=2>-----CPP Lab----</td>
<td align="center">Web Technologies</td>
<td align="center">-------</td>
<td align="center" colspan="2">Web Technologies lab</td>
11. Write a HTML program to create a form using text inputs, password inputs, multiple
line text input, buttons, checkboxes, radio buttons, selectboxes, and file select boxes.
<html>
<head>
<title>Forms</title>
</head>
<body>
<fieldset>
<html>
<head>
<title>Master page</title>
</head>
<frameset cols="50%,50%">
<frame src="Frame1.html">
<frame src="Frame2.html">
<frameset>
</html>
Style-sheets.html
<html>
<head>
<title>Different Style Sheets</title>
<style type="text/css">
@import url("style.css");
body
{
background-color:aqua;
font-size:16px;
} <!--Internal Style Sheet-->
</style>
</head>
<body>
<h1>Using External Style Sheet</h1>
<p style="color:blue;font-size:18px;">Inline Style Sheet</p>
</body>
</html>
14. Write a HTML program to create CSS on links,lists,tables and generated content.
<html>
<head>
<title>CSS onlinks,lists,tables and generated content</title>
<style type="text/css">
links.c
{
color:blue;
}
li.a,b
{
list-style-type:decimal;
}
table
{
width:350px;
border-collapse+separate;
}
<html>
<head>
<title>AV college Home</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1">
<style>
*{
box-sizing:border-box;
}
body
{
margin:0;
}
.header
{
background-color:aqua;
padding:9px;
font-size:40px;
}
.topnav
{
overflow:hidden;
background-color:gray;
}
.topnav a
{
float:left;
display:block;
color:#f2f2f2;
text-align:center;
padding:14px 16px;
text-decoration:none;
}
.topnav a:hover
{
background-color:#dddddd;
color:black;
}
.column
{
float:left;
padding:8px;
}
16.Write a HTML program to create your college website using for mobile device.
<html>
<head>
<title>AV college Home</title>
<meta charset="utf-8">
17. Write a HTML program to create login form and verify username and password using
DOM
18. Write a Java script program to calculate area of rectangle using function.
<html>
<head>
<title>Login Form</title>
</head>
<body>
<h1 style= "text-align:
center;font-size:40pt;color:#00FF00;">Login Form</h1>
<form name="login">
<html>
<head>
<script >
var length = prompt("Enter a whole number for the length of your
rectangle.");
var width = prompt("Enter a whole number for the width of your
rectangle.");
function area(length, width)
{
return length * width;
}
document.writeln('The area of your rectangle is ' + area(length,
width));
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<title>Show good morning good night wish as per time Javascript</title>
</head>
<body>
<script type="text/javascript">
document.write("<center><font size=+3 style='color:
green;'>");
var day = new Date();
var hr = day.getHours();
if (hr >= 0 && hr < 12)
{
document.write("Good Morning!");
}
else if (hr == 12)
{
document.write("Good Noon!");
}
else if (hr >= 12 && hr <= 17)
{
document.write("Good Afternoon!");
}
else
{
document.write("Good Evening!");
}
document.write("</font></center>");
</script>
</body>
</html>
21. Write a JavaScript program to print a multiplication table of a given number using a
loop.
<html>
<head>
<title>Multiplication Table</title>
</head>
<body>
<p>
<script type="text/javascript">
var num=prompt("Enter any number");
i=1
while(i<=10)
{
document.write(num + " x " + i + " = " +
(num*i) + "<br>")
i++;
}
</script>
</p>
</body>
</html>
<html>
<head>
<html>
<head>
<script>
function myFunction()
{
alert("Thank you for visiting W3Schools!");
}
</script>
</head>
<body onunload="myFunction()">
<h2>Welcome to my Home Page</h2>
<p>Close this window or press F5 to reload the page.</p>
</body>
</html>
<html>
<head>
<script>
function imgError()
{
alert('The image could not be loaded.');
}
</script>
</head>
<body>
<img src="image.gif" onerror="imgError()">
<html>
<head>
<script>
function bigImg(x)
{
x.style.height = "64px";
x.style.width = "64px";
}
function normalImg(x)
{
x.style.height = "32px";
x.style.width = "32px";
}
</script>
</head>
<body>
<img onmouseover="bigImg(this)"
onmouseout="normalImg(this)" border="0" src="download.png"
alt="Smiley" width="32" height="32">
v. onClick Event:
<html>
<head>
<script type = "text/javascript">
function sayHello()
{
alert("Hello World")
23. Write a JavaScript program using JavaScript built in objects.(in this program I used
date built in functions).
<html>
<body>
<center>
<h2>Date Methods</h2>
<script type="text/javascript">
var d = new Date();
document.write("<b>Locale String:</b> " + d.toLocaleString()+"<br>");
document.write("<b>Hours:</b> " + d.getHours()+"<br>");
document.write("<b>Day:</b> " + d.getDay()+"<br>");
document.write("<b>Month:</b> " + d.getMonth()+"<br>");
document.write("<b>FullYear:</b> " + d.getFullYear()+"<br>");
document.write("<b>Minutes:</b> " + d.getMinutes()+"<br>");
</script>
</center>
</body>
</html>
24. Write a JavaScript program to create registration form validate all fileds using form
validation.
<html>
<head>
<title>form validation</title>
<style type="text/css">
formTitle{vertical-align:top;text-align:right;}
</style>
<script type="text/javascript">
funtion validate(form)
{
var returnValue=true
var name=form.txtName.value
if(name=="")
{
<html>
<head>
<title>Welcome</title>
</head>
<body>
student.xsl
<?xml version = “1.0”?>
<!--student.xsl-->
<xsl:stylesheet version=”1.0”
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
xmlns=”http://www.w3.org/TR/xhtm11/strict”>
<xsl:template match=”/”>
<h2> Student record</h2>
<xsl:for-each select=”students/student”>
<br/>
<span style= “font-weight:bold;color:red”> FirstName:</span>
<xsl:value-of select= “name/firstname”/>
<span style= “font-weight:bold;color:red”> LastName:</span>
<xsl:value-of select= “name/lastname”/> <br/>
<span style= “font-weight:bold;color:green”> Street:</span>
<xsl:value-of select= “address/street”/> <br/>
<span style= “font-weight:bold;color:green”> City:</span>
<xsl:value-of select= “address/city”/> <br/>
<span style= “font-weight:bold;color:blue”> Email:</span>
<xsl:value-of select= “address/email”/> <br/>
<span style= “font-weight:bold;color:green”> Phone:</span>
<xsl:value-of select= “address/phone”/> <br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
student.css
<!--student.css-a style sheet for the student.xml document-->
student{display: block; margin-top:15px; color:blue;}
name{display: block; margin-left:40px;margin-top: 30pt;color:red}
firstname{font-size; 28pt;}
lastname{font-size; 28pt;}
address{display: block; margin-left:40px:color:green}
street{display: block;font-size: 18pt;}
city{display: block;font-size: 18pt;}
email{display: block;font-size: 18pt;color:blue}
phone{display: block;font-size: 18pt;}
student4.xml
<?xml version= “1.0”?>
<!--student4.xml for XSLT-- >