0% found this document useful (0 votes)
80 views33 pages

Open Source Software Lab

The document describes how to create a basic calculator application using JavaScript. It defines functions for adding, subtracting, multiplying and dividing numbers. Buttons are created corresponding to the numbers 0-9 and operators +, -, * and /. Clicking the number buttons will add that number to the textbox. Clicking the operator buttons will store the operator for the calculation and clear the textbox. A function calculates the result and displays it when the equals button is clicked.

Uploaded by

Yuvaraj Yuvaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views33 pages

Open Source Software Lab

The document describes how to create a basic calculator application using JavaScript. It defines functions for adding, subtracting, multiplying and dividing numbers. Buttons are created corresponding to the numbers 0-9 and operators +, -, * and /. Clicking the number buttons will add that number to the textbox. Clicking the operator buttons will store the operator for the calculation and clear the textbox. A function calculates the result and displays it when the equals button is clicked.

Uploaded by

Yuvaraj Yuvaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Open Source Software Lab

---------------------------------------------

1. CREATE A WEB PAGE WITH FRAMES AND TABLES

Book Store

<html>
<head>
<title>Book Store </title></head>
<body>
<frameset rows="18%,*">
<frame src="topframe.html" scrolling="no">
<frameset cols="15%,*">
<frame src="leftframe.html" noresize/>
<frame src="rightframe.html" name="rframe"/>
</frameset>
</frameset>
</body>
</html>

Top frame

<html>
<head>
<title>Top Frame </title></head>
<body bgcolor=#bbffbb>
<table border=”1” width=”100%”>
<tr>
<th width="14%">
<imgsrc="shop.jpg" width=100 height=50/>
</th>
<th width="80%"><u>Online Book Shopping</U></th>
</tr></table>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<table border="1" width="100%">


<tr>
<th><a href="rightframe.html"
target="rframe">Home</a></th>
<th><a href="catalogue.html"
target="rframe">Catalogue</a></th>
</tr>
</table>
</body></html>

Left Frame

<html>
<head><title>Left frame </title></head>
<body bgcolor=#ffffcc><center>
<h4><a href="cse.html" target="rframe">Computer
Science</a></h4>
<h4><a href="it.html" target="rframe">IT</a></h4>
</center></body>
</html>

Right Frame

<html>
<head><title>Right frame </title></head>
<body bgcolor="Silver">
<h2>Welcome To Online Book Shopping</h2>
<h1><u><center>Welcome To A AGovt Arts
College,VPM</center></u></h1>
</body>
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

Catalogue

<html>
<title>Catalogue </title>

<body bgcolor="pink">
<form>
<table border="1" width="100%"><tr>
<td><imgsrc="java.jpg" width=100 height=100/></td>
<td>Book:Java Programming <br>Author:C.Muthu<br> Tata
Publication, Chennai.</td>
<td>Rs.150 &nbsp; &nbsp; &nbsp; &nbsp;</td>
<td><input type="button" value="Add To Cart"/></td></tr>
<tr><td><imgsrc="internet.jpg" width=100
height=100/></td>
<td>Book:Internet and its
Application<br>Author:P.Rizwan<br> Tata Mcgrow
Publications, Chennai.</td>
<td>Rs.150 &nbsp; &nbsp; &nbsp; &nbsp;</td><td>
<input type="button" value="Add To Cart"/></td></tr>
</table></from>
</body></html>

Computer Science

<html>
<body bgcolor="scanda" text="black">
<h2><b><u><i>Book List<br></b></u></i></h2>
<h3>Internet and its Application<br>
<ol>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<li>Data Mining<br>
<li>Cryptography<br>
<li>Microprocessor and its Application<br>
<li>Programming in C++ and Data Structure<br>
<li>Digital Logic And Microprocessor<br>
</ol>
</h3>
</body>
</html>
IT

<html>
<body bgcolor="skyblue" text=black>
<h2><b><u><i>Book List<br></b></u></i></h2>
<h3>Data Mining<br>
<ol>
<li>Network Security and Cryptography<br>
<li>Mobile Computing<br>
<li>Open Source Software<br></h3>
</ol>
</body>
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

output

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

2. CREATE A WEB PAGE INCORPORATING CSS

XYZ.CSS

h3{font-family:arial;font-size:20;color:cyan}
table{border-color:green} td{font-
size:20pt;color:magenta}
Main

<html>
<head><h1><center>ALL STYLE SHEETS</CENTER></H1>
<title>Use of INTERNAL and EXTERNAL STYLE SHEETS</title>
<link rel="stylesheet" href="xyz.css" type="text/css">
<style type="text/css">
.vid{font-family:verdana;font-
style:italic;color:red;text-align:center}
.ani{font-family:tahoma;font-style:italic;font-
size:20;text-align:center}
font{font-family:georgia;font-
size:20;color:blue;}ul{list-style-type:circle}</style>
</head>
<body>
<ol style="list-style-type:lower-alpha">
<b><center>A AGovt Arts COLLEGE,
Villupuram.</center><b><br><br>
<li>Department of Computer Science
<li>PG Department of Information Technology
<li>PG & Research Department of Computer Science
</ol>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<center><p style="font-size:20pt;color:purple">Mrs
BHARATHI, HOD</p></center>
<p class="ani">A A Govt Arts College, Villupuram-
605602<br>Afflicated to Thiruvalluvar
University,Vellore-623 115<br></p>
<h2 class="vid">GovermentAidedCollege</h2>
<font><hr><h2>List of Courses offered</h2></hr>
<ul><li>B.Com Genaral</li>
<li>B.Sc Mathematics</li>
<li>B.Sc Computer Science</li>
<li>B.A English</li>
<li>BBA</li>
<li>BCA</li>
<li>B.Com Computer Application</li>
<li>M.Sc IT</li>
<li>M.Sc Mathematics</li>
</ul>
</font>
<h3>Result of BCA Student </h3>
<table width="100%" cellpadding="2" border="5">
<tr><th>S.NAME</TH>
<th>MARKS</th>
<th>Result</th>
</tr>
<tr><td align="center"> Xavier</td>
<td align="center"> 100</td>
<td align="center"> Pass</td></tr>
<tr><td align="center">Devishree</td>
<td align="center"> 99</td>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<td align="center"> Pass</td></tr>


<tr><td align="center">Arun</td>
<td align="center"> 98</td>
<td align="center"> Pass</td></tr>
</table></body></html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

3. WRITE A SHELL PROGRAM TO FIND THE FACTORIAL OF


ANINTEGER POSITIVE NUMBER.

echo "ENTET A POSITIVE NUMBER"


read n
f=1
until test $n -lt 1;
do
f=`expr $f \* $n`
n=`expr $n - 1`
done
echo "FACTIORIAL IS $f"

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

admin@linux-rei3:~>sh fac.sh
ENTET A POSITIVE NUMBER
5
FACTIORIAL IS 120

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

4. WRITE A SHELL PROGRAM FOR CHECKING WHETHER A


GIVEN STRING IS A PALINDROME OR NOT.

admin@linux-rei3:~> vi p.sh
clear
echo "Enter a string"
read str
echo
len=`echo $str | wc -c`
len=`expr $len - 1`
i=1
j=`expr $len / 2`
echo "j= $j ; len=$len;;"
while test $i -le $j;
do
k=`echo $str | cut -c $i`
l=`echo $str | cut -c $len`
if test $k != $l;
then
echo "Not Palindrome"
exit
fi
i=`expr $i + 1`
len=`expr $len - 1`
echo " i = $i len = $len; k = $k; l=$l"
done
echo "Palindrome"

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

Enter a string
madam

j= 2 ; len=5;;
i = 2 len = 4; k = m; l=m
i = 3 len = 3; k = a; l=a
Palindrome

Enter a string
abcdefg

j= 3 ; len=7;;
Not Palindrome

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

5. CREATE SIMPLE CALCULATOR IN JAVA SCRIPT

<html>
<head>
<title>Calculator</title>
<script type="text/javascript">
varres,t,m,p,q;
function prs(a,c)
{
res=a + c;
return res;
}
function prs1(a,c)
{
p=a
t=c;
document.f1.t1.value="";
}
function eq(c)
{
if(t=="+")
{
q=eval(p)+eval(c);
}
if(t=="-")
{
q=eval(p)-eval(c);
}
if(t=="*")
{
q=eval(p)*eval(c);
}

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

if(t=="/")
{
q=eval(p)/eval(c);
}
return(q);
}

function clear_text(m,n)
{
document.f1.t1.value="";
}
</script>
</head>
<body>
<form name=f1>
<input type="textbox" name="t1" size="30"><br><br><br>
<input type="button" name="c" value ="1"
onclick="t1.value=prs(t1.value,c.value);"
>&nbsp;&nbsp;&nbsp
<input type="button" name="c1" value ="2"
onclick="t1.value=prs(t1.value,c1.value);"
>&nbsp;&nbsp;&nbsp
<input type="button" name="c2" value ="3"
onclick="t1.value=prs(t1.value,c2.value);">&nbsp;&nbsp;
&nbsp
<input type="button" name="c12" value ="+"
onclick="prs1(t1.value,c12.value);"><br><br><br>
<input type="button" name="c3" value= "4"
onclick="t1.value=prs(t1.value,c3.value);">&nbsp;&nbsp;
&nbsp

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<input type="button" name="c4" value ="5"


onclick="t1.value=prs(t1.value,c4.value);">&nbsp;&nbsp;
&nbsp
<input type="button" name="c5" value ="6"
onclick="t1.value=prs(t1.value,c5value);">&nbsp;&nbsp;&
nbsp
<input type="button" name="c13" value ="-"
onclick="prs1(t1.value,c13.value);"><br><br><br>
<input type="button" name="c6" value ="7"
onclick="t1.value=prs(t1.value,c6.value);">&nbsp;&nbsp;
&nbsp
<input type="button" name ="c7" value ="8"
onclick="t1.value=prs(t1.value,c7.value);">&nbsp;&nbsp;
&nbsp
<input type="button" name="c8" value= "9"
onclick="t1.value=prs(t1.value,c8.value);">&nbsp;&nbsp;
&nbsp
<input type="button" name="c14" value ="*"
onclick="prs1(t1.value,c14.value);"><br><br><br>
<input type="button" name ="c9" value ="."
onclick="t1.value=prs(t1.value,c9.value);">&nbsp;&nbsp;
&nbsp
<input type="button" name ="c10" value ="0"
onclick="t1.value=prs(t1.value,c10.value);">&nbsp;&nbsp
;&nbsp
<input type="button" name ="c11" value ="="
onclick="t1.value=eq(t1.value);">&nbsp;&nbsp;&nbsp
<input type="button" name="c15" value ="/"
onclick="prs1(t1.value,c15.value);"><br><br><br>
<input type="button" name="c16" value ="cls"
onclick="clear_text();"><br><br><br>
</form>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------
6. Write a JavaScript program to scroll your name
in the scroll bar.

<html>
<head>
<script lang="javascript">
document.write('<style type="text/css">');
document.write("#textarea {");
document.write("background-color:#009999;");
document.write("SCROLLBAR-HIGHLIGHT-COLOR:#3366cc; ");
document.write("SCROLLBAR-SHADOW-COLOR:#000099; ");
document.write("SCROLLBAR-ARROW-COLOR:#000099; ");
document.write("SCROLLBAR-TRACK-COLOR:#000099; ");
document.write("SCROLLBAR-DRAKSHADOW-COLOR:#000099; ");
document.write("SCROLLBAR-BASE-COLOR:#6699ff; ");
document.write(" }");
document.write("</style>");
</script></head>
<body>
<textarea id="textarea" rows="10" cols="38">
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------
A AGovt Arts COLLEGE, Villupuram.
A AGovt Arts COLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
A AGovtArtsCOLLEGE, Villupuram.
</textarea></body></html>
<html>
<head>
<STYLE TYPE="text/css">
BODY {
scrollbar-arrow-color:#F2B30d;
scrollbar-track-color:#FFFFCC;
scrollbar-shadow-color:#FFFFFF;
scrollbar-face-color:#FFFFCC;
scrollbar-drakshadow-color:#F2B30d;
scrollbar-3dlight-color:#F2B30d;
}
</STYLE>
</head>
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

7. DEVELOP A PROGRAM AND CHECK MESSAGE PASSING MECHANISM


BETWEEN PAGES.

<html>
<head><title>My Form</title></head>
<?php
//Capture the values posted to the php program from the
text fields
//which were named 'your name ' and ' favorite word '
respectivily
$College=$_REQUEST['college'];
$Dept=$_REQUEST['department'];
?>
<body bgcolor="green" text="white">
<p>
<h2>Hi Your College Name is<br>
<b><?php print $College; ?></b></h2>
<p>
<br>
<h3>Your Department is <br>
<b><?php print $Dept;?>!?!</b></h3>
</body>
</html>

form.html

<html>
<head><title>My Form</title>
</head>
<body>
<form action="favorite.php" method=post>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<table cellspacing=0 cellpading=0 border=0>


<tr>
<td>College Name:
<td><input type="text" name="college" size=50>
</tr>
<tr>
<td>Department Name
<td><input type="text" name="department" size=50>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="Display!">
</tr>
</form>
</body>
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

8. DEVELOP A PROGRAM AND CHECK FILE SYSTEM FUNCTIONS,


DATE & TIME FUNCTIONS.

<html>
<head>
<title>Welcome To MazharulUloom College</title>
</head>
<body>
UG Courses Offered:<BR>
B.A Corporate Economics<BR>
B.ScMethematics<BR>
B.Sc Computer Science<BR>
B.Com<BR>
B.Com Corporate SecretaryShip<BR>
BCA<BR>
BBA<BR>
B.Sc Microbiology<BR>
B.Com Computer Application<BR>
B.A Functional English
B.ScInformaton System Management<BR><BR><BR>
PG Courses Offered:<BR>
M.ScInfomation Technology<BR>
M.Com<BR>
M.ScMethematics<BR>
M.A English<BR><BR><BR>
Research Courses Offered:<BR>
M.Phil Computer Science - FT/PT<BR>
M.Phil Commerce - FT/PT<BR>
Ph.D Computer Science - FT/PT<BR>
Ph.D Commerce - FT/PT<BR>
Ph.D English - FT/PT<BR>
</body>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------
P.php

<?php
echo("<h3>Result With Date():</h3><br/>");
echo("<br><b>".date("1")."</b><br/>");
echo("<br><b>".date("1 dS \of F Y h:i:s
A")."</b><br/>");
echo("<br><b>".date("1 dS F Y ")."</b><br/>");
echo("<h3>Oct 3,1975 was on a
".date("1",mktime(0,0,0,10,3,1975))."</h3><br />");
echo("<h3>Result With GMDate():</h3><br/>");
echo("<br><b>".gmdate("1")."</b><br/>");
echo("<br><b>".gmdate("1 dS \of F Y h:i:s
A")."</b><br/>");
echo("<br><b>".gmdate("1 dS F Y ")."</b><br/>");
echo("<h3>Oct 3,1975 was on a
".gmdate("1",mktime(0,0,0,10,3,1975))."</h3><br />");
echo("<br><b>TIME".time()."</b><br />");
?>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

Filesysfun.php

<<html>
<head>
<title>Welcome To AAGAC</title>
</head>
<body bgcolor="#999999"
<pre>
<?php
$filename="getmethod.html";
$fh=fopen("$filename","r");
while(!feof($fh)){
$content=fgets($fh);
echo $content."<BR>";
}
fclose($fh);
?>
</pre>
</body>
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

Output

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

9. Develop a program using Cookies and session

<!DOCTYPE html>
<?php
$cookie_name="college";
$cookie_value="Siga College of Management and Computer
Science";
setcookie($cookie_name, $cookie_value,
time()+(86400*30),"/"); // 56400=1 day
?>
<html>
<body>
<?php
if(!isset($_COOKIE[$cookie_name])){
echo"Cookie named'".$cookie_name."' is not set!";
}
else
{
echo"Cookie'".$cookie_name."' is set!<br>";
echo"Value is :" .$_COOKIE[$cookie_name];
}
?>
<p><strong>Note:</strong> you might have to relaod the
page to see the value of the cookie.</p>
</body>
</html>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

<!DOCTYPE html>
<?php
session_start();
if (isset($_SESSION['count']))
{
echo "You Have Vistited the Page in &nbsp<b>" .
$_SESSION['count'] . "</b>&nbsp times<br>";
$_SESSION['count']++;
}
else
{
$_SESSION['count']=1;
echo " This is the First Time You visit this page";
}
?>

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram
Open Source Software Lab
---------------------------------------------

OUTPUT

---------------------------------------------
Aringar Anna Govt. Arts College, Villupuram

You might also like