23SEC201 - Web Programming - Practical
23SEC201 - Web Programming - Practical
(Deemed to be University)
(Established Under Section 3 of UGC Act, 1956)
(Accredited with A+ Grade by NAAC in the Second Cycle)
Pollachi Main Road, Eachanari Post, Coimbatore – 641 021
I B.Sc.CS
SEMESTER - II
Name :
Register No. :
1
KARPAGAM ACADEMY OF HIGHER EDUCATION
(Deemed to be University)
(Established Under Section 3 of UGC Act, 1956)
(Accredited with A+ Grade by NAAC in the Second Cycle)
Pollachi Main Road, Eachanari Post, Coimbatore – 641 021
4 HTML FORMS
6 FRAMES
7 HORIZONTAL FRAMES
3
EX. NO:1
CREATING A WEB PAGE USING HTML
AIM:
To create a web page using following formatting – Bold, Italics, Underline, Colors,
Headings, Title, Font and Font Width, Background, Paragraph, Line Breaks,
Horizontal Line, Blinking text as well as marquee text.
ALGORITHM:
4
PROGRAM:
<html>
<!--Title of the Web page -->
<title>First Web Program </title>
<!-– Body background -->
<body bgcolor="yellow">
<center>
My First Web Page</center>
<!-– Horizontal Line -->
<hr>
<br>
<br>
<!--Bold -->
<b>HTML is the code that is used to structure a web page and its content.<b><br>
<!--Underline -->
<u>HTML is not a programming language; it is a markup language</u><br>
<!--Italics -->
<i> HTML is a markup language </i><br>
<!-– Font color and size -->
<font color="Blue" size=10>Originally, HTML was primarily designed as a language </font>
<!-- Paragraph -->
<p>HTML, its supporting DOM APIs, as well as many of its supporting technologies, have
been developed over a period of several decades by a wide array of people with different
priorities
who, in many cases, did not know of each other's existence.</p>
<br>
<!-– Blinking Text --- >
<blink> Here is your text that has to blink. </blink><br>
<!-- Marquee Text -->
<marquee>This is basic example of marquee</marquee><br>
<!-– Headings -->
<h1>My main title</h1>
<h2>My top level heading</h2>
5
<h3>My subheading</h3>
<h4>My sub-subheading</h4>
<h5>My text in h5</h5>
<h6> Text in h6</h6>
<br>
</body>
</html>
6
OUTPUT:
RESULT:
The above HTML program is executed successfully and the output is verified.
7
EX. NO:2 WEB PAGE USING LISTS, IMAGES, INTERNAL AND EXTERNAL
LINKS
AIM:
To create a web page using Ordered Lists, Unordered Lists, Inserting images, Internal
and External Links.
ALGORITHM:
8
PROGRAM:
Filename: p2.html
<html>
<title> Lists, Images and Links </title>
<body>
<font face="Arial"><u><b>Ordered Lists:</b></u></font>
<!--Ordered Lists-->
<ol>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
<li>Mango</li>
</ol>
<br>
<font face="Arial"><u><b>Unordered Lists:</b></u></font>
<!-- Unordered Lists-->
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
<li>Mango</li>
</ul>
<br>
<! -- Adding Images -->
<img src="C:\Users\user\Pictures\cup.jpg" alt="Cup" height=200 width=200>
<br>
<!-- Internal Linking -->
<a href="#top">Top</a>
9
OUTPUT:
10
Next.html:
RESULT:
The above HTML program is executed successfully and the output is verified.
11
EX. NO: 3
TABLE CREATION IN HTML
AIM:
To create a Table using HTML.
ALGORITHM:
STEP 1: Start. Open Notepad and type the codeto create table.
STEP 2: Create a table using <table></table>
STEP 3: Create rows in the table using <tr>This is the row tag</tr>.
STEP 4: Insert the data into rows using <td> Table Data</td> tags.
STEP 5: Close the </table> and </html> tag.
12
PROGRAM:
<html>
<body>
<h1><center>TIME TABLE</center></h1>
<table border="5" cellspacing="0" align="center">
<!--<caption>Timetable</caption>-->
<tr>
<td align="center" height="50"width="100"><br>
<b>Day/Period</b></br>
</td>
<td align="center" height="50"width="100">
<b>I<br>9:30-10:20</b>
</td>
<td align="center" height="50"width="100">
<b>II<br>10:20-11:10</b>
<td align="center" height="50"width="100">
<b>III<br>11:10-12:00</b>
</td>
<td align="center" height="50"width="100">
<b>12:00-12:40</b>
</td>
<td align="center" height="50"width="100">
<b>IV<br>12:40-1:30</b>
</td>
<td align="center" height="50"width="100">
<b>V<br>1:30-2:20</b>
</td>
<td align="center" height="50"width="100">
<b>VI<br>2:20-3:10</b>
</td>
<td align="center" height="50"
width="100">
<b>VII<br>3:10-4:00</b>
</td>
</tr>
13
<tr>
<td align="center" height="50">
<b>Monday</b></td>
<td align="center" height="50">Eng</td>
<td align="center" height="50">Maths</td>
<td align="center" height="50">Che</td>
<td rowspan="6" align="center" height="50">
<h2>L<br>U<br>N<br>C<br>H</h2><td colspan="3" align="center"height="50">LAB</td>
<td align="center" height="50">Phy</td>
</tr>
<tr>
<td align="center" height="50">
<b>Tuesday</b>
</td>
<td colspan="3" align="center"height="50">LAB
</td>
<td align="center" height="50">Eng</td>
<td align="center" height="50">Che</td>
<td align="center" height="50">Maths</td>
<td align="center" height="50">SPORTS</td>
</tr>
<tr>
<td align="center" height="50">
<b>Wednesday</b>
</td>
<td align="center" height="50">Maths</td>
<td align="center" height="50">Phy</td>
<td align="center" height="50">Eng</td>
<td align="center" height="50">Che</td>
<td colspan="3" align="center"height="50">LIBRARY
</td>
</tr>
<tr>
<td align="center" height="50">
14
<b>Thursday</b>
</td>
<td align="center" height="50">Phy</td>
<td align="center" height="50">Eng</td>
<td align="center" height="50">Che</td>
<td colspan="3" align="center"height="50">LAB
</td>
<td align="center" height="50">Maths</td>
</tr>
<tr>
<td align="center" height="50">
<b>Friday</b>
</td>
<td colspan="3" align="center"height="50">LAB
</td>
<td align="center" height="50">Maths</td>
<td align="center" height="50">Che</td>
<td align="center" height="50">Eng</td>
<td align="center" height="50">Phy</td>
</tr>
<tr>
<td align="center" height="50">
<b>Saturday</b>
</td>
<td align="center" height="50">Eng</td>
<td align="center" height="50">Che</td>
<td align="center" height="50">Maths</td>
<td colspan="3" align="center"height="50">SEMINAR
</td>
<td align="center" height="50">SPORTS</td>
</tr>
</table>
</body>
</html>
15
OUTPUT:
RESULT:
The HTML code for creating Table is executed successfully.
16
EX. NO: 4
HTML FORMS
AIM:
To create a web page using input type, select and TextArea in HTML.
ALGORITHM:
STEP 1: Start. Open Notepad and type the code.
STEP 2: Create a form using <form>. Create labels for Username, Address and Select Car.
STEP 3: For Username, Address and Drop down box, use <input> tag, <textArea> and
<select> tag respectively
STEP 4: Give the options in the Drop down list.
STEP 5: Stop the program and execute in Browser.
17
PROGRAM:
<html><body>
<form>
<h1>Login Form</h1>
<label><b>Username</b></label>
< !—Input type -- >
<input type="text" placeholder="Enter Username" name="uname" required><br><br>
<label><b>Address</b></label>
<! – TextArea -- >
<textarea name=add rows=3 cols=20 placeholder="Optional"
wrap></textarea><br>
<br>
<! – Select -- >
<label><b>Select Car</b></label>
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
</body>
</html>
18
OUTPUT:
RESULT:
The above HTML program is executed successfully and the output is verified.
19
EX. NO: 5
HTML FORMSIN TABULAR FORM
AIM:
To create a HTML Form containing Roll No, name of the student and Grades in a tabular
form.
ALGORITHM:
20
PROGRAM:
<html>
<head>
</head>
<body>
<html>
<body>
<form>
<h1>Student Data</h1>
<table border=1>
<tr>
<td> Roll No</td><td><input type ="text"></td></tr>
<td> Student Name</td><td><input type ="text"></td></tr>
<td> Grades</td><td><input type ="text"></td></tr>
</table>
</body>
</html>
21
OUTPUT:
RESULT:
HTML code using <form>, <table> and <input> tags is verified and executed successfully.
22
EX. NO: 6
FRAMES
AIM:
To create a web page using Frames in HTML.
ALGORITHM:
23
PROGRAM:
home.html
<html>
<head>
<title>Home page</title>
</head>
<frameset rows="20,80">
<frame src="head.html" name="head_page">
<frameset cols="15,85">
<frame src="dept.html" name="dept_page">
<frame src="desc.html" name="des_page">
</frameset>
</frameset>
</html>
head.html
<html>
<head>
<title>Head Page</title>
</head>
<body>
<font face="Arial Black" size="3">
<table border="1" cellspacing="2" cellpadding="5" width="100%">
<tr>
<td align="center"><img src="6.jpg" width="20" height="20"/></td>
<td colspan="4" align="center">Bachelor of Computer Applications</td>
</tr>
<tr>
<td align="center"><a href="description.html" target="des_page">HOME</a></td>
<td align="center"><a href="login.html" target="des_page">LOGIN</a></td>
<td align="center"><a href="registration.html"
target="des_page">REGISTRATION</a></td>
<td align="center"><a href="catalogue.html" target="des_page">CATALOGUE</a></td>
<td align="center"><a href="cart.html" target="des_page">CART</a></td>
24
</tr>
</table>
</font>
</body>
</html>
dept.html
<html>
<head>
<title>Departments Page</title>
</head>
<body>
<font face="Arial Black" size="4">
<table align="center" height="100%">
<tr>
<td><a href="cat_mca.html" target="des_page">MCA</a></td>
</tr>
<tr>
<td><a href="cat_mba.html" target="des_page">MBA</a></td>
</tr>
<tr>
<td><a href="cat_bca.html" target="des_page">BCA</a></td>
</tr>
</table>
</font>
</body>
</html>
desc.html
<html>
<head>
<title> Description page</title>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br>
25
<font face="TIMES NEW ROMAN" size="5">
<center>
Description of the Website
</center>
</font>
</body>
</html>
26
OUTPUT:
RESULT:
27
EX. NO: 7
HORIZONTAL FRAMES
AIM:
To create a web page using Horizontal Frames in HTML.
ALGORITHM:
28
PROGRAM:
head.html
<html>
<frameset rows="50%,50%">
<frame src="head.html" />
<frame src="table.html" />
</frameset>
</frameset>
</html>
frame.html
<html>
<head>
<title>Head Page</title>
</head>
<body>
<font face="Arial Black" size="3">
<table border="1" cellspacing="2" cellpadding="5" width="100%">
<tr>
<td align="center"><img src="6.jpg" width="20" height="20"/></td>
<td colspan="4" align="center">Bachelor of Computer Applications</td>
</tr>
<tr>
<th>Course</th>
<th>Year</th>
<td colspan ="3">Java</td>
<td rowspan="2"></td><td colspan="2"></td>
</tr>
<tr>
<td colspan ="3">High</td>
<td colspan="2"></td>
</tr>
</tr>
</table>
</body>
</html>
30
OUTPUT:
RESULT:
31
EX. NO: 8
WEB PAGE USING INLINE CSS
AIM:
To create a web page using Inline Cascading Style Sheet.
ALGORITHM:
32
PROGRAM:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
33
OUTPUT:
The program to create web page using Inline CSS is executed successfully.
34
EX. NO: 9
WEB PAGE USING INTERNAL STYLESHEETS
AIM:
To create a web page using Internal / Embedded Style Sheet.
ALGORITHM:
35
PROGRAM:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color:blue;
font-family:verdana;
font-size:300%;
p{
color:red;
font-family:courier;
font-size:160%;
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
36
OUTPUT:
This is a heading
This is a paragraph.
RESULT:
The program to create web page using Embedded CSS is executed successfully.
37
EX. NO: 10
WEB PAGE USING EXTERNAL STYLESHEETS
AIM:
To create a web page using External Style Sheet.
ALGORITHM:
38
PROGRAM:
CSS
#para1
{color: red;
text-align: center;
font-family:courier;
h1
color:blue;
font-size:200%;
text-align:right;
background-color: #6495ed;
39
#para
color: green;
text-align: center;
font-size:500%;
padding:10px;
margin:30px;
background-color: #e0ffff;
body
background-image:url("bird.jpeg");
div
text-decoration:overline;
font-size:200%;
Html Code
<!DOCTYPE html>
<html>
<head>
40
<link rel="stylesheet" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
used to create web pages. html has a very simple syntax. html uses tags for
case-insensitive.</div>
</body>
</html>
41
OUTPUT:
This is a heading
This is a green paragraph.
html is a markup language. it stands for hypertext mark up language. it is used to create web pages.
html has a very simple syntax. html uses tags for formatting and for placing objects. html is
interpreted by the browser. it is case-insensitive.
RESULT:
The program to create web page using External CSS is executed successfully.
42
EX. NO: 11 JAVASCRIPT PROGRAM TO CALCULATE SQUARES AND
CUBES
AIM:
JavaScript program to compute squares and cubes of numbers from 5 to 15.
ALGORITHM:
43
PROGRAM:
<html>
</head>
<title>JS Demo</title>
<script>
function at()
{
var res="";
for(i=5;i<=15;i++)
{
res +="Num "+(i)+ " : square "+(i*i)+" : cube "+(i*i*i)+"\n"
}
alert(res);
}
</script>
</head>
<body>
<input type="button" onclick="at()" value="Click to get squares and cubes">
</body>
</html>
44
OUTPUT:
RESULT:
The JavaScript program to compute the squares and cubes of numbers from 5 to 15 is
executed successfully.
45
EX. NO: 12 JAVASCRIPT PROGRAM TO FIND THE LARGEST OF THREE
NUMBERS
AIM:
JavaScript program to find the largest of three numbers.
ALGORITHM:
46
PROGRAM:
<html>
</head>
<title>JS Demo</title>
<script>
// program to find the largest among three numbers
47
OUTPUT:
48
The largest of three nos.135
RESULT:
The JavaScript program to find the largest of three numbers is executed successfully.
49
EX. NO: 13 JAVASCRIPT PROGRAM TO FIND THE FACTORIAL OF A
NUMBER
AIM:
JavaScript program to find the factorial of a number.
ALGORITHM:
50
PROGRAM:
<html>
</head>
<title>JS Demo</title>
<body><b><center> Factorial of a number</center><br></b>
<script>
const number = parseInt(prompt('Enter a positive integer: '));
// if number is 0
else if (number === 0) {
document.write(`The factorial of ${number} is 1.`);
}
// if number is positive
else {
let fact = 1;
for (i = 1; i <= number; i++)
{fact *= i;
}
document.write(`The factorial of ${number} is ${fact}.`);
}
</script>
</head>
</body>
</html>
51
OUTPUT:
RESULT:
The JavaScript program to find the factorial of a given number is executed successfully.
52
EX. NO: 14 JAVASCRIPT PROGRAM TO CALCULATE SUM AND AVERAGE
OF NUMBERS
AIM:
ALGORITHM:
53
PROGRAM:
<html>
<script>
var totalSum = 0;
for(var i=0;i<10;i++)
totalSum=totalSum+i;
document.write("<br>");
</script>
</html>
54
OUTPUT:
RESULT:
The JavaScript program to calculate the sum and average of numbers is executed
successfully.
55
EX. NO: 15 JAVASCRIPT PROGRAM TO COUNT POSITIVE, NEGATIVE
NUMBERS IN THE LIST
AIM:
JavaScript program to count the number of negative numbers, positive numbers and
zeros in the list.
ALGORITHM:
56
PROGRAM:
<html>
<head>
<script>
var zero=0;
var positive=0;
var negative=0;
let num=new Array();
var n=parseInt(window.prompt(“Enter the array size”,””);
for (var i=0;i<n;i++)
{
num[i]=window.prompt("Enter numbers","");
}
for (var i=0;i<n;i++)
{
document.write(num[i]+"<br>");
}
57
OUTPUT:
RESULT:
JavaScript program to count positive numbers, negative numbers and zeros are executed
successfully.
58
EX. NO: 16 JAVASCRIPT PROGRAM TO PROMPT USER NAME
AIM:
JavaScript program to prompt username and display it.
ALGORITHM:
59
PROGRAM:
<html>
<head>
<title>
Greetings </title>
</head>
<body>
<script language="JavaScript">
document.write("Hello " +
</script>
</body>
</html>
60
OUTPUT:
RESULT:
61