Professional Documents
Culture Documents
SECOND YEAR
MSC COMPUTER SCIENCE
CERTIFICATE
<html>
<body>
<ol type="l">
</ol>
<ul type="square">
</ul>
</body>
</html>
Output
Hardware devices
1. CD-ROM drive
2. 2DVD drive
3. Hard disk
4. 4.Modem
Web languages
* HTML
* Javascript
* PHP
* Java
<html>
<body>
<h4>Cell that spans two columns:</h4>
<table border = "1">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<td>Bill Gates</td>
<td>555 77 854</td>
<td>555 77 854</td>
</tr>
</table>
<h4>Cell that spans two rows:</h4>
<table border = "1">
<tr>
<th>First Name</th>
<td>Bill Gates</td>
</tr>
<tr>
<th rowspan="2">Telephone:</th>
<td>555 77 854</td>
</tr>
<tr>
<td>555 77 854</td>
</tr>
</table>
</body>
</html>
Output
3 - Program Using Data Definition
<html>
<body>
<dl>
<dt>HTML</dt>
<dd>A markup language</dd>
<dt>Pen</dt>
<dd>A writing tool</dd>
<dt>Lettuce</dt>
<dd>A vegetable</dd>
<dt>Technology</dt>
<dd>The development of tools which serve as a means to certain objectives</dd>
<dt>Megabyte</dt>
<dd>A unit of data conisting of 1024 kilobytes</dd>
</dt>
</body>
</html>
Output
HTML
A markup language
Pen
A writing tool
Lettuce
A vegetable
Technology
The development of tools which serve as a means to certain objectives
Megabyte
A unit of data conisting of 1024 kilobytes
<html>
<body>
<a name="top">The top of the page</a>
<br/></br>
<a href="#bottom">Jump to the bottom of the page</a>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<a href="#top">Jump to the top of the page</a>
<br/></br>
<a name="bottom">The bottom of the page</a>
</body>
</html>
Output
5 - Program Using Image
<html>
<body>
<a href="http://www.yahoo.com"target="_blank">
<img src="I:\Msc Practical\HTML\images/swan.jpg"alt="Swan" />
</a>
</body>
<p>
Click on the image to be taken to the Yahoo search engine
</p>
</html>
Output
6 - Program Using Types of Link
<html>
<head>
<style type="text/css">
body {background-image:url('paper.gif');}
h1 {text-decoration:underline;}
</style>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
<html>
<head>
<style type="text/css">
a:link {color:#FF0000;}
a:visited {color:#00FF00;}
a:hover {color:#FF00FF;}
a:active {color:#0000FF;}
</style>
</head>
<body>
<p><b><ahref="default_asp"target="_blank">This is a link</a></b></p>
</body>
</html>
<html>
<head>
<style type="text/css">
a.one:link{color:#ff0000;}
a.one:visited{color:#0000ff;}
a.one:hover{color:#ffcc00;}
a.two:link{color:#ff0000;}
a.two:visited{color:#0000ff;}
a.two:hover{font-size:150%;}
a.three:link{color:#ff0000;}
a.three:visited{color:#0000ff;}
a.three:hover{background:##66ff66;}
a.four:link{color:#ff0000;}
a.four:visited{color:#0000ff;}
a.four:hover{font-family:monospace;}
a.five:link{color:#ff0000;text-decoration:none;}
a.five:visited{color:#0000ff;text-decoration:none;}
a.five:hover{text-decoration:underline;}
</style>
</head>
<body>
<p>Mouse over the links to see them change layout </p>
<p><b><aclass="one"href="default.asp"target="_blank">This link changes color</a></b></p>
<p><b><aclass="two"href="default.asp"target="_blank">This link changes font-
size</a></b></p>
<p><b><aclass="three"href="default.asp"target="_blank">This link changes background-
color</a></b></p>
<p><b><aclass="four"href="default.asp"target="_blank">This link changes font-
family</a></b></p>
<p><b><aclass="five"href="default.asp"target="_blank">This link changes text-
decoration</a></b></p>
</body>
</html>
<html>
<head>
<style type="text/css">
<a:link, a:visited
{
display:block;
font-weight:bold;
color:#ffffff;
background-color:#98bf21;
width:120px;
text-align:center;
padding:4x;
text-decoration:none;
}
a:hover, a:active
{
background-color:#7A991A;
}
</style>
</head>
<body>
<ahref="default.asp"target="_blank">This is a link</a>
</body>
</html>
Output
<html>
<head>
<title> String formatting </title>
</head>
<body>
<script type = "text/javascript">
var someString = new String("This is the test string");
document.writeln(someString.big());
document.writeln(someString.blink());
document.writeln(someString.sup());
document.writeln(someString.strike());
document.writeln(someString.bold());
document.writeln(someString.italics());
document.writeln(someString.small());
document.writeln(someString.link('http://www.java2s.com'));
</script>
</body>
</html>
Output
8 - Program Using Do While Loop
<html>
<body>
<script type="text/javascript">
i=0;
do
{
document.write("This number is"+i);
document.write("<br/>");
i++;
}
while(i<=5)
</script>
<p>Explanation:</p>
<p><b>i</b> equal to 0</p>
<p> The loop will run</p>
<p><b>i</b> will increase by 1 each time the loop runs </p>
<p>While<b>i</b> is less than, or equal to 5, the loop will continue to run</p>
</body>
</html>
Output
9 - Program Using OnClick
<html>
<head>
<script type="text/javascript">
function myfunction(txt)
{
alert(txt);
}
</script>
</head>
<body>
<form>
<input type="button" onClick="myfunction('Good Morning!')"
value = "In the Morning">
<input type="button" onClick="myfunction('Good Evening!')"
value = "In the Evening">
</form>
</body>
</html>
Output
<html>
<body>
<script type = "text/javascript">
function person(firstname,lastname,age,eyecolor)
{
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
}
myFather=new person("John","Doe",50,"blue");
document.write(myFather.firstname + " is " + myFather.age + " years old.");
</script>
</body>
</html>
Output
<html>
<head>
<script type = "text/javascript">
function show_confirm()
{
var r=confirm("Press a button!");
if(r==true)
{
alert("You pressed OK!");
}
else
{
alert("You pressed Cancel!");
}
}
</script>
</head>
</body>
<input type="button" onClick="show_confirm()" value="Show a confirm box"/>
</body>
</html>
Output
12 - Program Using JQuery
<html>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tr:gt(3)").css("background-color","red");
});
</script>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>AlfredsFutterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Berglundssnabbkop</td>
<td>Christina Berglund</td>
<td>Sweden</td>
</tr>
<tr>
<td>Centro comercialMoctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Ronal Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Koniglich Essen</td>
<td>Philip Cramer</td>
<td>Germany</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>MagazziniAlimentariRiuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
<tr>
<td>North/South</td>
<td>Simon Crowther</td>
<td>UK</td>
</tr>
</table>
</body>
</html>
Output
<html>
<body>
<script type="text/vbscript">
Dim famname(5)
famname(0)="Jan Egil"
famname(1)="Tove"
famname(2)="Hege"
famname(3)="Stale"
famname(4)="Kai Jim"
famname(5)="Borge"
for i=0 to 5
document.write(famname(i) &"<br/>")
Next
</script>
</body>
</html>
Output
Jan Egil
Tove
Hege
Stale
Kai Jim
Borge
<html>
<head>
<script type = "text/vbscript">
function myFunction()
alert("Hello World!")
end funtion
</script>
</head>
<body onload="myFunction()">
<p>We usually use the head section for functions(to be sure that the functions are loaded before
they are called)</p>
</body>
</html>
Output
We usually use the head section for functions (to be sure that the functions are loaded before they
are called).
15 - Simple Program
<html>
<body>
<script type = "text/vbscript">
some text ="Welcome to our web site!!"
document.write(Left(sometext,5))
document.write("<br/>")
document.write(Right(some text,5))
</script>
</body>
</html>
Output
<html>
<head>
<script type="text/javascript">
funtion writeText(txt)
{
document.getElementById("desc").innerHTML=txt;
}
</script>
</head>
<body>
<imgsrc="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap"/>
<map name="planetmap">
<area shape="rect" coords="0,0,82,126"
on mouseover = "writeText('The Sun and the gas giant planets like Jupiter are by far the largest
objects in our Solar System.')"
href="sun.html" target="_blank" alt="Sun"/>
<p id="desc">Mouse over the sun and the planets and see the different descriptions.</p>
</body>
</html>
Output
The Sun and the gas giant planets like Jupiter are by far the largest objects in our Solar System.
17 - Program Using OnError Event
<html>
<head>
<script type="text/javascript">
onerror=handleErr;
var txt="";
function handleErr(msg,url,l)
{
txt="There was an error on this page.\n\n";
txt+="Error:"+msg+"\n";
txt+="URL:"+url+"\n";
txt+="Line:"+l+"\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
return true;
}
function message()
{
addalert("Welcome guest!");
}
</script>
</head>
<body>
<input type="button" value="View message" onclick="message()"/>
</body>
</html>
Output
18 - Program Using OnClick
<html>
<head>
<title>Example of onClick Event Handler</title>
<script>
function valid(form){
var input=form.data.value;
alert("Hello" +input+"!Welcome...");
}
</script>
</head>
<body>
<h3>Example of onClick Event Handler</h3>
Click on the button after inputting your name into the text box:<br>
<form>
<input type="text"Name="data">
<input type="button"Value="Click here"onClick="valid(this.form)">
</form>
</body>
</html>
Output
19 - Simple Asp Program
<html>
<head>
<title>HTML tags in scripts</title>
</head>
</body>
<% Response.write("<b><i>This text will be bold and italic</i></b>")
Response.write("<br/><a href='http://www.landofcode.com'>Landofcode.com main page</a>")
%>
</body>
</html>
Output
<html>
<body>
<form action="demo_totalbytes.asp" method="post">
Please type something:
<input type="text" name="txt"><br/><br/>
<input type="submit" value="Submit">
</form>
<%
if Response.Form("txt")<>"Then
Response.Write("You submitted:")
Response.Write(Request.Form)
Response.Write("<br/><br/>")
Response.Write("Total bytes:")
Response.Write(Request.Totalbytes)
End if
%>
</body>
</html>
Output
Total bytes:11
21 - Program Using Response.Write
<html>
<body>
<p>
<b> You are browsing this site with:</b>
<%Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b> Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b> The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b> The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b> The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b> The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b> The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
</body>
</html>
Output
<%dim numvisits
response.cookies("NumVisits").Expires=date+365
numvisits=request.cookies("NumVisits")
if numvisits=""then
response.cookies("NumVisits")=1
response.write("Welcome! This is the first time you are visiting this web page.")
else
response.cookies("NumVisits")=numvisits+1
response.write("You have visited this")
response.write("Web page" &numvisits)
if numvisits=1 then
response.write "time before!"
else
response.write "time before!"
else if
end if
%>
<html>
<body>
</body>
</html>
Output
Welcome! This is the first time you are visiting this Web page.
23 - ASP Program
<html>
<% dim cars
cars=Request.Form("Cars")
%>
<body>
<form action="demo_radiob.asp" method="post">
<p> Please select your favorite car:</p>
<input type="radio" name="cars"
<%if cars="Volvo" then Response.Write("checked")%>
value="Volvo">Volvo</input>
<br/>
<input type="radio" name="cars"
<%if cars="Saab" then Response.Write("checked")%>
value="Saab">Saab</input>
<br/>
<%if cars="BMW" then Response.Write("checked")%>
value="BMW">BMW</input>
<br/><br/>
<input type="submit" value="Submit"/>
</form>
<%
if cars<>"then Response.Write("<p>Your favorite car is: "&cars&"</p>")
end if
%>
</body>
</html>
Output
Volvo
® Saab
BMW
<html>
<body>
<form action="demo_simpleform.asp" method="post">
Your name: <input type="text" name="fname" size="20"/>
<input type="submit" value="Submit"/>
</form>
<%
dim fname
fname=Request.Form("fname")
if fname<>"" Then
Response.Write("Hello" &fname& "!<br/>")
Response.Write("How are you today?")
End if
%>
</body>
</html>
Output
Hello dd!
heading
{
font-family:cursive;
display:block;
font:bold 18pt;
}
job
{
display:block;
font-weight:bold;
background:grey;
color:white;
padding:2px;
margin-top:10px;
}
name{font-style:italic}
tel
{
display:block;
font-weight:bold;}
Output
Company Managers
John smith
555-9494
555-6363
Accounts manager
Sally jones
555-8282
Production manager
Bob Solomon
555-7171
26 - Program Using CSS
CATALOG
{
background-color:#ffffff;
width:100%;
}
CD
{
display:block;
margin-bottom:30pt;
margin-left:0;
}
TITLE
{
color:#FF0000;
font-size:20pt;
}
ARTIST
{
color:#0000FF;
font-size:20pt;
}
COUNTRY,PRICE,YEAR,COMPANY
{
display:block;
color:#000000;
margin-left:20pt;
}
XML
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Greatest Hits</TITLE>
<ARTIST>Dolly Parton</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>RCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1982</YEAR>
</CD>
<CD>
<TITLE>Still got the blues</TITLE>
<ARTIST>Gary Moore</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Virgin Records</COMPANY>
<PRICE>10.20</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Eros</TITLE>
<ARTIST>Eros Ramazzotti</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>BMG</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1997</YEAR>
</CD>
<CD>
<TITLE>One night only</TITLE>
<ARTIST>Bee Gees</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1998</YEAR>
</CD>
<CD>
<TITLE>Sylvias Mother</TITLE>
<ARTIST>Dr.Hook</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS</COMPANY>
<PRICE>8.10</PRICE>
<YEAR>1973</YEAR>
</CD>
<CD>
<TITLE>Maggie May</TITLE>
<ARTIST>Rod Stewart</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Pickwick</COMPANY>
<PRICE>8.50</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Romanza</TITLE>
<ARTIST>Andrea Bocelli</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>10.80</PRICE>
<YEAR>1996</YEAR>
</CD>
<CD>
<TITLE>When a man loves a woman</TITLE>
<ARTIST>Percy Sledge</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Atlantic</COMPANY>
<PRICE>8.70</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Black Angel</TITLE>
<ARTIST>Savage Rose</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Mega</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1995</YEAR>
</CD>
<CD>
<TITLE>1999 Grammy Nominees</TITLE>
<ARTIST>Many</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Grammy</COMPANY>
<PRICE>10.20</PRICE>
<YEAR>1999</YEAR>
</CD>
<CD>
<TITLE>For the good times</TITLE>
<ARTIST>Kenny Rogers</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Mucik Master</COMPANY>
<PRICE>8.70</PRICE>
<YEAR>1995</YEAR>
</CD>
<CD>
<TITLE>Big Willie style</TITLE>
<ARTIST>Will Smith</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1997</YEAR>
</CD>
<CD>
<TITLE>Tupelo Honey</TITLE>
<ARTIST>Van Morrison</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>8.20</PRICE>
<YEAR>1971</YEAR>
</CD>
<CD>
<TITLE>Soulsville</TITLE>
<ARTIST>JornHoel</ARTIST>
<COUNTRY>Norway</COUNTRY>
<COMPANY>WEA</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1996</YEAR>
</CD>
<CD>
<TITLE>The very best of</TITLE>
<ARTIST>Cat Stevens</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Island</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Stop</TITLE>
<ARTIST>Sam Brown</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>A and M</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Bridge of Spies</TITLE>
<ARTIST>T'Pau</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Siren</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Private Dancer</TITLE>
<ARTIST>Tina Turner</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Capitol</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1983</YEAR>
</CD>
<CD>
<TITLE>Midtomnatten</TITLE>
<ARTIST>Kim Larsen</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Medley</COMPANY>
<PRICE>7.80</PRICE>
<YEAR>1983</YEAR>
</CD>
<CD>
<TITLE>Pavarotti Gala Concert</TITLE>
<ARTIST>Luciano Pavarotti</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>DECCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1991</YEAR>
</CD>
<CD>
<TITLE>The doc of the bay</TITLE>
<ARTIST>Otis Redding</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Atlantic</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Picture book</TITLE>
<ARTIST>Simply Red</ARTIST>
<COUNTRY>EU</COUNTRY>
<COMPANY>Elektra</COMPANY>
<PRICE>7.20</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Red</TITLE>
<ARTIST>The Communards</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>London</COMPANY>
<PRICE>7.80</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Unchain my heart</TITLE>
<ARTIST>Joe Cocker</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>EMI</COMPANY>
<PRICE>8.20</PRICE>
<YEAR>1987</YEAR>
</CD>
</CATALOG>
Output
Bob Dylan
USA
Columbia
10.901985
Bonnie Tyler
UK
CBS Records
9.901982
Dolly Parton
USA
RCA
9.901982
Gary
Moore
UK
Virgin Records
10.201990
Eros
Ramazzotti
EUBMG
9.901997
Bee Gees
UK
Polydor
10.901998
Dr.Hook
UKCBS
8.101973
Rod Stewart
UK Pickwick
8.501990
Andrea Bocellie
UPolydor
10.801996
Percy Sledge
JSAAtlantic
8.701987
Savage Rose
EUMega
10.901995
ManyUSA
Grammy
10.201999
Kenny Rogers
UKMucik Maste
8.701995
Will Smith
USAColumbia
9.901997
Van Morrison
UKPolydor
9.201971
Lorn Hoel
Norway
WEA7.901996
Cat Stevens
UKIsland
8.901990
Sam Brown
UKA and M
8.901998
PauUKSiren
8.901987
Tina Turner
UK
Capitol
8.901983
Kim Larsen
UMedley