Rotate linked banners with a fade

Posted on 2009-05-19
Last Modified: 2013-12-25
I have 5 banners with links to within my site that I want to rotate on my home page. I would also like to have these banners transition with a fade if possible.

I've been able to locate code that takes care of the rotation piece but it only works in IE (see below).

Any assistance is greatly appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<ilayer id="l1">
	<layer id="l2">
		<div id="l1">
			<div id="l3" style="position:relative">
<script language="JavaScript">
// ***********************************************
// URL:
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( )
// ***********************************************
var bannerArray = new Array();
var myCount=0;
// Banner Code Assignment
bannerArray[0] = "<A HREF=\"\"><IMG SRC=\"\" border=\"0\" width=\"468\" height=\"60\"></A>";
bannerArray[1] = "<A HREF=\"\"><IMG SRC=\"\" border=\"0\" width=\"468\" height=\"60\"></A>";
bannerArray[2] = "<A HREF=\"\"><IMG SRC=\"\" border=\"0\" width=\"468\" height=\"60\"></A>";
function bannerRotate() {
if(myCount > bannerArray.length-1){myCount=0;}
// Write out rotation
	if (document.all){			// it is IE
	else if (document.layers){	// it is NN;
setTimeout("bannerRotate()", 3000);
// -->

Open in new window

Question by:wattanabi2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 29

Accepted Solution

David H.H.Lee earned 500 total points
ID: 24428629
Hi wattanabi2,
Ok, i've amended the code for rotation that work for other browser like firefox. If you're looking for fade effect, that may only work in i.e version. Check this article:
....//existing code 
if (document.all){                      // it is IE
        else if (document.layers){      // it is NN
	else if (document.getElementById){
         //add this line... 

Open in new window


Author Closing Comment

ID: 31583277
Thanks x_com. While I'm still missing the fade piece, this gets me off to a good start. I'll take a look at the link and will try to work in the fade piece from there.

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question