DHTML : A gallery of scrolling images
Contents ]
Dr Benton

Setting Up the Script

This workshop does not present any major difficulties, except for the recurrent browser compatibility problem which we always have to consider. If you are an experienced programmer, you probably already know that Internet Explorer supports the creation of a scrolling banner with the <MARQUEE> tag. The problem is that Netscape Navigator does not recognise it. Our goal in this workshop will be to detect the visitor's browser and to use either the <MARQUEE> tag for Internet Explorer or a customised code to emulate this tag for Netscape's browser.

We must first define the size and images of our gallery. This is a matter of declaring a few JavaScript variables and assigning the required values as follows:

<script language="JavaScript1.2">
<!--
var largvisio=330
var hautvisio=145
var vitessevisio=4

The first two variables, (largvisio and hautvisio), are used to define the dimensions of our image banner in pixels. The vitessevisio variable sets the scrolling speed of the images. The higher the value assigned, the faster the scrolling will be. You are free to choose the values you want for your site.



1   2   3   4   5