Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

PRACTICE PRACTICALS

INFORMATION TECHNOLOGY

PRACTICAL-1
Use of Audio on web pages using HTML5
Create a webpage named audio.html to set an audio file in web page with controls such that it uses
HTML5 elements. The audio file must play as soon as the webpage loads in browser and it will
start over again, every time when it is completed.

Create another webpage named audio1.html which provides multiple source file formats for the
same audio file that plays a sound automatically with controls. The browser should display the
message with appropriate attribute, when audio file is not supported by browser. The code must
incorporate the list of sound files formats (like wav, MP3 or ogg etc).
audio.html
<!DOCTYPE html>
<html>
<head>
<title> Single source file</title>
</head>
<body>
<h1>Audio with loop </h1>
<Audio controls autoplay loop=”2”>
<source src="Kalimba.mp3" type="audio/mp3">
</audio>
</body>
</html>

audio1.html
<!DOCTYPE html>
<html>
<head>
<title> Multiple source file</title>
</head>
<body>
<h1>Audio with multiple sources</h1>
<Audio controls autoplay >
<source src="Kalimba.mp3" type="audio/mp3">
<source src="Kalimba.ogg" type="audio/ogg">
<source src="Kalimba.wav" type="audio/wav">
</audio>
</body>
</html>
PRACTICAL-2
Use of video on web pages using html5.
Create a webpage named video.HTML to display a video file on web page and plays automatically
with controls. The dimension of video area should be 150 * 150 pixels.

Create another webpage which provide multiple source file formats for the same audio file that
plays a sound automatically with controls. The dimension of video area should be 100*100 pixels.
The browser should display the message with appropriate attribute when audio file is not supported
by browser. The code must incorporate the list of video files formats (like webM, MP4 or ogg etc).

video.html
<html>
<head>
<title> Single source file</title>
</head>
<body>
<VIDEO src="video.mp4" width=”150” height=”150” controls autoplay>
</VIDEO>
</body>
</html>

Video1.html
<html>
<head>
<title> Multiple source file</title>
</head>
<body>
<VIDEO width=”100” height=”100” controls autoplay>
<SOURCE src=”video.mp4” type=”video/mp4”>
<SOURCE src=”video.ogg” type=”video/ogg”>
</VIDEO>
</body>
</html>
PRACTICAL-3
Navigation on an image using Client side image Mapping in web page using html 5.
Create a webpage named imagemap. html with an inserted image having jpeg, png or gif extension.
Create 3 different shapes (like rectangle, circle and polygon) which do not overlap. Note the co-
ordinates making use of Ms-Paint/GIMP/IrfanView/Pinta. Each shape should be mapped or
navigate with a different URL that should navigate to a local webpage.
Imagemap.html
<!doctype html>
<html>
<head>
<title> image mapping</title>
</head>
<body>
<h1> this is image mapping</h1>
<img src="COFFEE.jpg" alt="this is an coffee image" height="183" width="275"
usemap="#imgmap">

<map name="imgmap">
<area shape="rect" coords="192,100,243,127" alt="this is rectangle" href="rect.html">
<area shape="poly" coords="73,24,43,60,107,62" alt="this is triangle" href="poly.html">
<area shape="circle" coords="160,100,18" alt="this is circle" href="circle.html">
</map>
</body>
</html>

Create 3 files named as


1. rect.html
2. poly.html
3. circle.html

PRACTICAL-4
Javascript program to accept string from user and count number of vowels in the given
string.

<! DOCTYPE html>


<script language="javascript">

function Vowels()
{
var str = f1.t1.value;
var count=0, total_vowels = " ";
for(var i=0; i<str.length;i++)
{
if( str.charAt(i).match(/[a-zA-Z]/)!=null)
{
if (str.charAt(i).match(/[aeiouAEIOU]/))
{
count++;
}
}
}

alert("The Number of vowels in the string is " + count);


}
</script>
<body>
<form name="f1">
Enter the String: <input type="text" name="t1"><br><br>
<input type=”button” name=”b1” onClick=”Vowels()” value="Count">
</form>
</body>
</html>
PRACTICAL-5
JavaScript program to accept string from user and reverse the given string and check
whether it is palindrome or not.

<! DOCTYPE html>


<script language="javascript">

function rev( )
{
var s=f1.t1.value;
var a=s.length;
var ch="";
for(i=a-1;i>=0;i--)
{
ch+=s.substring(i,i+1)
}
alert("The Reverse string is "+ch);
}

function Palindrome()
{
var revStr = "";
var str = f1.t1.value;
var i = str.length;
for(var j=i; j>=0; j--)
{
revStr = revStr+str.charAt(j);
}
if(str == revStr)
{
alert(str+" -is Palindrome");
}
else
{
alert(str+" -is not a Palindrome");
}
}
</script>
<body>
<form name="f1">
Enter the String: <input type="text" name="t1"><br><br>
<input type="button" name="b1" onClick="rev( ) ;Palindrome()" value="Check">

</form>
</body>
</html>
PRACTICAL-5
Write a PHP program to check if a person is eligible to vote or not. The program should
include the following-
 Minimum age required for vote is 18.
 Use PHP functions.
 Use Decision making statement.
Vote.php
<!DOCTYPE html>
<html>
<head>
<title>Eligible to Vote or not</title>
</head>
<body>
<form method="post">
Enter your Age : <input type="text" name="t1" placeholder="Enter age">
<br>
<input type="submit" name="submit" value="submit">
</form>
<?php
if (isset($_POST['submit']))
{
vote();
}
function vote()
{
$a = $_POST['t1'];
intval($a);
if($a>=18)
{
echo "You are Eligible for Vote";
}
else
{
echo "You are not Eligible for Vote";
}
}
?>
</body>
</html>
PRACTICAL-6
Write a PHP function to count the total number of vowels (a,e,i,o,u)from the string. Accept a
string by using HTML form.
Vowels.php
<html>
<head>
<title>Count no. of vowels</title>
</head>
<body>
<H2>SYJC PHP Practicals</H2>
<h3> Vowels in a String</h3>

<form action="" method="POST">


<input type="text" name="pstring" >
<input type="submit" >
</form>
</body>
</html>
<?php
if($_POST)
{
$pstring = strtolower($_POST['pstring']);
$vowels = array('a','e','i','o','u');
$len = strlen($pstring);
$num=0;
for($i=0; $i<$len; $i++)
{
if(in_array($pstring[$i], $vowels))
{
$num++;
}
}
echo "Number of vowels :".$num;
}
?>

You might also like