Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Web programming
1. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
1)The document must have a paragraph of text that describes yourhome. Choose at least three
different phrases (3 to 6 words) of this paragraph and make them change font, font style,
color and font size when the mouse cursor is placed over them. Each of the different phrases
must change to different fonts, font styles, colors and font sizes.
<!-------changecolorfont------>
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>Dynaamic fonts for link</title>
<style type="text/css">
.regText{font:Times;font-size:14pt;}
</style>
</head>
<body>
<p clss="regText">
My Home Name Is
<b style="color:blue;"
onmouseover="this.style.color='red';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
Basava Krupa
</b>.It is lacated nearby Govt polytechnic college,
In Basav nagar,
<b style="color:blue;"
onmouseover="this.style.color='orange';
this.style.font='bold 16pt Arial';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
Bijapur
2. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
</b>.My house is facing Towards
<b style="color:pink;"
onmouseover="this.style.color='red';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
East
</b>.It is double bed home.there is a 16 foot road in front of
the home.
There is a sufficient place for
<b style="color:brown;"
onmouseover="this.style.color='yellow';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
gardening
</b>.and car motor cycle parking,it is built in the
<u style="color:gray;"
onmouseover="this.style.color='brown';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
Area 45x40 squire foot
</u>.
</p>
</body>
</html>
4. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
2)The document must contain fourshort paragraphs of text stacked on top of each other with
only enough of each showing so that the mouse cursor can also be placed oversome part of
them. When the cursor is placed over the exposed part of any paragraph it should raise to the
top to become completely visible.
<!----Stcking.html---->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>Dynamic stackin Paragraph</title>
<script type="text/javascript" src="stacking.js">
</script>
<style type="text/css">
.para1 {color:red;position:absolute; top: 10px; left: 10px;
z-index: 0;background-color:yellow}
.para2 {color:green;position:absolute; top: 30px; left: 100px;
z-index: 0;background-color:gray}
.para3 {color:black;position:absolute; top: 50px; left: 200px;
z-index: 0;background-color:white}
.para4 {color:brown;position:absolute; top: 70px; left: 300px;
z-index: 0;background-color:pink}
</style>
</head>
<body>
<p class="para1" id='p1' onmouseover="toTop('p1');">
A dynamic Xhtml document,which can be modifiedeither
while it is being displayed or after it has been
displayed.
more Specifically,A dynamic xhtml is one whose tag attributes,
tag contents are elements stylemore Specifically,A dynamic xhtml is
one whose tag attributes, tag contents are elements style
5. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
properties can changed after the documents has been displayed
or while is being displayed.
</p>
<p class="para2" id='p2' onmouseover="toTop('p2');">
The default layout of XHTML elements in the documents is from left
to right
in the way text is placed in any text editor . when the row is filled ,laying out
The default layout of XHTML elements in the documents is from left
to right
in the way text is placed in any text editor . when the row is filled ,laying out
</p>
<p class="para3" id='p3' onmouseover="toTop('p3');">
A dynamic Xhtml document,which can be modifiedeither
while it is being displayed or after it has been displayed.
more Specifically,A dynamic xhtml is one whose tag attributes,
tag contents are elements style
properties can changed after the documents has been displayedor while is being displayed.
</p>
<p class="para4" id='p4' onmouseover="toTop('p4');">
A dynamic Xhtml document,which can be modifiedeither
while it is being displayed or after it has been displayed.
more Specifically,A dynamic
xhtml is one whose tag attributes,
tag contents are elements style
properties can changed after the documents has been displayedor while is being displayed.
</p>
</body>
</html>//stacking.js
var oldTop="p1";
function toTop(newTop)
6. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
{
domTop = document.getElementById(oldTop).style;
domNew = document.getElementById(newTop).style;
domTop.zIndex = "0";
domNew.zIndex = "10";
oldTop = newTop;
}
**OUTPUT**
8. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
3)The document should have a small image of yourself, which must appear when the mouse
button is clicked at the position of the mouse cursor, regardless of the position of the cursorat
the time.
<!----move.html----->
<?xml version="1.0" encoding="utf-8" ?>
<html>
<head>
<script type="text/javascript" src="move.js">
</script>
</head>
<body onmousedown="display(event);">
<img id="myimage"
style="position:absolute; left=10; top=10;"
src="mycar.jpg"
alt="May car"
width=200 height=200 />
</body>
</html>
//move.js
function display(evt)
{
var dom=document.getElementById("myimage");
dom.style.left=evt.clientX+"px";
dom.style.top=evt.clientY+"px";
}
10. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
4)The document must contain the statement “Save time with TIMESAVER 2.2”, which
continuously moves back and forth across the top of the display
<!----movetext.html---->
<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<script type="text/JavaScript">
mesg="save time with TIMESAVER 2.2";
isNS= (navigator.appName=="Netscape")
isIE= (navigator.appName=="Microsoft Internet Explorer")
text=("<i><font size=2>"+mesg+"</font></i>")
if(isNS){
document.write("<blink>" + text + "</blink>")}
else if(isIE){
document.write("<MARQUEE BEHAVIOR=ALTERNATE DIRECTION=RIGHT>" +text+"</MARQUEE>")}
</script>
</body>
</html>
**OUTPUT**
12. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
PART IIXML
5)Design an XML document to store information about patience in a hospital. Information about
patients must include name (in 3 parts, first name, middle name, last name), social security
number (SSN), age, room number, primary insurance company – including member
identification number, group number and address – secondary insurance company (in the same
sub parts as for the primary insurance company), known medical problems, and known drug
allergies. Both attributes and nested tags must be included. Make up sample data of atleast 4
patients.
<?xml version="1.0" encoding="utf-8"?>
<patients>
<patient>
<name>
<fname> Manjunath </fname>
<mname> Sangappa </mname>
<lname> Uppaladinni </lname>
</name>
<ssn> SSN12345 </ssn>
<age> 22 </age>
<room> 123 </room>
<insurance type="primary">
<id> 9945921 </id>
<gno> 413 </gno>
<address> Vijayapur </address>
</insurance>
<insurance type="secondary">
<id> 814784 </id>
<gno> 214 </gno>
<address> Bagalkot </address>
</insurance>
<medproblem> High B.P. </medproblem>
<drugallergie> Nill </drugallergie>
28. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
PART-III PHP
PHP- Write, test and debug PHP scripts for the following specification
9)Parameter - A string of numbers separated by spaces
Return Value – The first 4 digits number in the string; false if none.
<html>
<body>
<?php
function display($str)
{
$words=explode(" ", $str);
$n=$words[0];
$n=substr($n,0,4);
$n=(double) $n;
return $n;
}
$str="1234567 4567785 6784953 8902123";
$n=display($str);
echo $n;
?>
</body>
</html>
30. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
10)Parameter – A file variable of a file of text where the words are separated by spaces or colons
Return value – The word that appears most common in the file.
<?php
function countfrequency($myFile)
{
$fh=fopen($myFile, 'r');
$theData=fread($fh,filesize($myFile));
$theData=eregi_replace(" +", " ", $theData);
$delim=" ";
$words=explode($delim,$theData);
$frequency=array_count_values($words);
$size=sizeof($frequency);
$keys=array_keys($frequency);
$values=array_values($frequency);
for($i=0;$i<$size;$i++)
{
print "<b>$keys[$i]:</b> $values[$i]<br/>";
}
$index=0;
$l=$values[$index];
for($i=1;$i<$size;$i++)
{
if($values[$i]>$l)
{
$l=$values[$i];
$index=$i;
}
}
return $keys[$index];
31. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
}
$myFile="testFile.txt";
$word=countfrequency($myFile);
echo "The word that appears most common is:<b>$word</b>";
?>
//testFile.text
BasavRaj Savalagi BMS Basavaraj Basava BasavRajSavalagi BasavRaj Basava BasavRaj Basava
32. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
11)Write an XHTML document to include an anchor tag, that calls a PHP document also write the
called PHP document which returns a randomly choosen greeting from a list of five different
greetings. The greetings must be stored as constant strings in the script. A random number
between 0 and 4 can be computed with these line.
#set the seed for mtrand with the number of microseconds
#since the last full second of the clock
mt_strand((double) microtime() * 1000000);
$number=mtrand(0,4); #computes a random integer0-4
<!--greeting.html-->
<?xml version="1.0" encoding="utf-8" ?>
<html>
<head>
<title>Preferred Greeting page</title>
</head>
<body>
Do you prefer a formal greeting or an informal greeting?
<a href="greeting.php">Display greeting</a>
</body>
</html>
<!--greeting.php-->
<?php
$greeting=array();
$greeting[0]="Hello ,how are you Mr BasavRaj?";
$greeting[1]="Hi how are you today?";
$greeting[2]="Welcome to the my php page world";
$greeting[3]="Good morning every one";
$greeting[4]="Good evening and Good nigth";
$n=mt_rand(0,4);
echo $greeting[$n];
?>
35. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
11) Write the XHTML code to create the form with the following capabilities
a) A text widget to collect the users name
b) Four check boxes, one each for the following items
i) Four 100 watt light bulbs for Rs. 20=39
ii) Eight 100 watt light bulbs for Rs 40=20
iii) Four 100 watt long life light bulbs for Rs. 30=95
iv) Eight 100 watt long life light bulbs for Rs 70=49
c) A collection of 3 radio buttons that are labeled as follows
i) Visa
ii) Master Card
iii) Discover
<--orderfron.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title> Order from </title>
</head>
<body>
<form action="">
User name=<input type="text" name="myname" size="30"/> <br/>
select the items: <br/>
<input type="checkbox" name="b[]" value="20.39" checked="checked"/> four 100 watt light <br/>
<input type="checkbox" name="b[]" value="40.20" checked="checked"/> eight 100 watt light <br/>
<input type="checkbox" name="b[]" value="30.39" checked="checked"/> four 100 watt long life
light <br/>
<input type="checkbox" name="b[]" value="70.39" checked="checked"/> eight 100 watt long life
light <br/>
select the mode of the payment:<br/>
<input type="radio" name="paymode" value="visa" checked="checked" />Visa <br/>
<input type="radio" name="paymode" value="Master card" /> Master card <br/>
<input type="radio" name="paymode" value="discover"/> Discover <br/>
<input type="submit" value="Submit Order"/>
<input type="reset" value="Clear the form" />
</form>
37. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
13)Write a PHP script that computes the total cost of the ordered light bulbs from the exercise
12 after adding 13.5% VAT. The program must inform the buyer of exactly what was ordered
in table.
<--orderfrom.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title> Order from </title>
</head>
<body>
<form method="POST" action="calculate.php">
User name=<input type="text" name="myname" size="30"/> <br/>
select the items: <br/>
<input type="checkbox" name="b[]" value="20.39" checked="checked"/> four 100 watt light <br/>
<input type="checkbox" name="b[]" value="40.20" checked="checked"/> eight 100 watt light <br/>
<input type="checkbox" name="b[]" value="30.39" checked="checked"/> four 100 watt long life light
<br/>
<input type="checkbox" name="b[]" value="70.39" checked="checked"/> eight 100 watt long life
light <br/>
select the mode of the payment:<br/>
<input type="radio" name="paymode" value="Visa" checked="checked" />Visa <br/>
<input type="radio" name="paymode" value="Master card" /> Master card <br/>
<input type="radio" name="paymode" value="Discover"/> Discover <br/>
<input type="submit" value="Submit Order"/>
<input type="reset" value="Clear the form" />
</form>
</body>
</html>
38. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
<!--orderfrom.php-->
<?php
$name=$_POST["myname"];
$bulbs=$_POST["b"];
$pmode=$_POST["paymode"];
print "your name is: $name<br/>";
$total=0;
for($i=0; $i<sizeof($bulbs); $i++)
{
$vat=$bulbs[$i]*0.135;
$total=$total+$bulbs[$i]+$vat;
}
print "the total cost: $total<br/>";
print "your payment mode is by : $pmode";
?>
40. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
14) Write a XHTML code to create a form that collects favorite popularsongs, including the name
of the song, the composer and the performing artist or group. This document must call one PHP
script when the form is submitted and another torequest a current list of survey results
<!--Songform.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title> Song form </title>
</head>
<body>
<form method="post" action="processform.php">
Song name: <input type="text" name="sname" size="30" /> <br/>
Composer: <input type="text" name="cname" size="20"/> <br/>
Artists: <br/>
<input type="checkbox" name="artist[]" value="Flute Man" checked="checked"/> Flute
Man<br/>
<input type="checkbox" name="artist[]" value="Tabala Man" /> Tabala Man<br/>
<input type="checkbox" name="artist[]" value="Violin Man" /> Violin Man <br/>
<input type="checkbox" name="artist[]" value="support singers" /> Support Singers <br/>
<input type="submit" value="submit form" />
<input type="reset" value="clear form" />
</form>
</body>
</html>
<!--Processform.php-->
<?php
$songname=$_POST["sname"];
$compname=$_POST["cname"];
$artists=$_POST["artist"];
41. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
print "song name is: $songname <br/> ";
print "composer is: $compname <br/>" ;
print "artists: <br/>";
for($i=0; $i<sizeof($artists); $i++)
{
print "$artists[$i] <br/>";
}
?>
**OUTPUT**
42. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
15)Write a XHTML code to provide a form that collects names and telephone numbers. The
phone numbers must be in the format ddd-ddd-dddd. Write a PHP script that checks the
submitted telephone number to be sure that it confirms to the required format and then
returns a response that indicates whether the number was correct.
<!--Phoneform.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
</head>
<body>
<form method="post" action="validate.php">
Name:<input type="text" name="uname" size="30"/> <br/>
Telephone Number:<input type="text" name="phone" size="20"/> <br/>
<input type="submit" value="Submit Form"/>
<input type="reset" value="clear form"/>
</form>
</body>
</html>
<!--validate.php-->
<?php
$name=$_POST["uname"];
$phon=$_POST["phone"];
if(ereg("([0-9]{3})-([0-9]{3})-([0-9]{4})", $phon))
{
print "phone number entered is correct";
}
else
{
print "phone number entered is incorrect";
45. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
16)Modify the PHP script of exercise 11 to count the numberof visitors and display that number
for each visitor
Hint: Use a file to store current count.
<!--countvisitors.php-->
<?php
$count = file_get_contents("count.txt");
$count = explode("=", $count);
$count[1] =$count[1]+1;
$file = fopen("count.txt", "w+");
fwrite($file, "count=".$count[1]);
fclose($file);
print "Total number of visitors=".$count[1];
?>
**OUTPUT**