Oz Web Hub : the spot for the web design beginner

Home > Java scripts > Web resources

Rotating banners

Here is a great little script for rotating banners throughout your website. The code in the text box below can be copied and pasted into a simple text editor and saved, as is, as banner.js. Within this code you will notice that it is set up with three banners, each linked to a different url. You can have as many ads in this simple rotator as you wish, just add them following the same format as the ones shown. Also, ensure you change the var ad_count number from 3 to however many ads you have in the rotation

 

Naturally you change the URL and banner images to the ones you want. You will need to change the size of the banners if they are not the standard 468 * 60

Now place this script on the web pages you want the banners to appear

Back to Javascripts index

Rotating content

Paste the following in the Body of the page where you want the content to appear.

Just replace the Tip 1 text, and the rest of the "Tips" with your message. Be careful not to use any special characters or it will break the script.

 

Rotating images

Set to new image every 5 seconds

Place this in HEAD tags

 

 

Place in BODY tags

Define the images and set the timer for the slideshow in this section of the script:

gSlideshowInterval = 5; // how often the image is refreshed (time given in seconds)
gNumberOfImages = 5; // the total number of images used

gImages = new Array(gNumberOfImages);
gImages[0] = "images/slideshow.gif";
gImages[1] = "images/slideshow2.gif";
gImages[2] = "images/slideshow3.gif";
gImages[3] = "images/slideshow4.gif";
gImages[4] = "images/slideshow5.gif";

4) Define the first image to appear in the slideshow and the URL link (optional) in this section of the HTML code. You must include the NAME="slide" statement to invoke the script:

<P ALIGN=left><a href="http://www.ozwebhub.com"><IMG SRC="images/slideshow1.gif" BORDER=0 ALT="ozwebhub" NAME="slide"></a></P>

You must replace the images, slideshows and URLs with your own.

Back to Javascripts index

straight to the top

© Jenny Campbell