Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

DEPARTMENT OF COMPUTER ENGINEERING

Subject: Client Side Scripting Subject Code: 22519


Semester: 5th Course: Computer Engineering
Laboratory No: L001B Name of Subject Teacher: Prof Pokharkar M.S.
Name of Student: Roll Id:

Experiment No: 16
Title of Experiment Develop web page for implementing Banner and Slide Show

Theory:

1. Banner

The banner advertisement is the hallmark of every commercial web page. It is typically
positioned near the top of the web page, and its purpose is to get the visitor‘ attention
by doing all sorts of clever things. Nearly all banner advertisements are in a file format
such as a GIF, JPG, TIFF, or other common graphic fi le formats. Some are animated GIFs,
which is a series of images contained in one fi le that rotate automatically on the screen.

Steps

1. Create several banner advertisements using a graphics tool such as PhotoShop. You'll
want to make more than one advertisement so you can rotate them on your web page
using a JavaScript.

2. Create an <img> element in your web page with the height and width necessary to
display the banner advertisement.

3. Build a JavaScript that loads and displays the banner advertisements in conjunction
with the <img> element

Practical

<html >

<head>

<title>Banner Ads</title>

Page | 1
<script language="Javascript" type="text/javascript">

Banners = new Array('img1.jpg','img2.jpg','img3.jpg')

CurrentBanner = 0

function DisplayBanners()

if (document.images)

{ CurrentBanner

++

if (CurrentBanner == Banners.length)

CurrentBanner = 0

document.RotateBanner.src= Banners[CurrentBanner]

setTimeout("DisplayBanners()",1000)

</script>

</head>

<body onload="DisplayBanners()" >

<center>

<img src=”img1.jpg" width="400" height="300" name="RotateBanner" />

</center>

</body>

</html>

Page | 2
Page | 3
2. Slide Show
1. A slideshow is similar in concept to a banner advertisement in that a slideshow rotates
multiple images on the web page.
2. However, unlike a banner advertisement, a slideshow gives the visitor the ability to
change the image that's displayed:

3. The visitor can click the Forward button to see the next image and the Back button to
see the previous image
<html >
<head>
<title>Banner Ads</title>
<script language="Javascript" type="text/javascript">
Banners = new Array('img1.jpg','img2.jpg','img3.jpg')
CurrentBanner= 0
function next()
{ CurrentBanner
++
if (CurrentBanner == Banners.length)
{
CurrentBanner = 0
}
document.RotateBanner.src= Banners[CurrentBanner]

</script>
</head>
<body>
<center>
<img src="img1.jpg" width="400" height="300" name="RotateBanner" />
<br>
<button type="button" onclick="next()">Next</button>

</center>
</body>
</html>

Page | 4
Grade and P1 (35M) P2 (15 M) Total ( 50 M) Dated Sign
Dated
Signature of
Teacher

Page | 5

You might also like