Usually you just call some sort of function that switches the URL in a variable with the images. (or a counter)
So
code:
var aImg = new Array();
var aUrl = new Array();
var delay = 5000;
var imageNum = 0;
preLoadBanners();
function preLoadBanners() {
aImg[0] = new Image();
aImg[1] = new Image();
aImg[0].src = "/images/trammel_crow_banner.gif";
aImg[1].src = "/images/acacia_banner.gif";
// aUrl[0] = "http://www.trammelcrow.com/home.asp";
// aUrl[1] = "http://www.acaciafinancial.com";
}
function swapBanners() {
imageNum++
if(imageNum > 1) {
imageNum = 0
}
document.BANNER_IMG.src = aImg[imageNum].src;
}
function goToUrl() {
document.location.href = aUrl[imageNum];
return false;
}
Then just in your link you do
<a href="firstUrl.html" onClick="return goToUrl()">Link</a>
That of course is your code. I swapped around where the imageNum gets updated because I need it to be the current ImageNum not the next one. Also this should degrade gracefully.
.:[ Never resist a perfect moment ]:.
(Edited by bitdamaged on 11-19-2004 06:08)