[help] randomized images and links

Hey again, sorry to ask all the questions but it seems that I have hit another wall. I'm trying to do a random image thingy on my site for different affiliates and I'd like the images to link to the sites accordingly. I've been looking at javascript stuff online for awhile and there are a few things I'm absolutely clueless as to what to replace to make it work for myself.

I'm also open to using CSS if there's a way to do it that way; but be aware anyone that decides to put forth the help should be prepared for the frustration of an idiot. :P

Thanks in advance.

#267216

Have you tried some of the articles over at ALA?

Random Image Rotation

A Better Image Rotator

#267228

Thanks for the links but the thing about stuff like this is that I'm extremely dense when it comes to actually doing it. So that pretty much bewildered me even more.

#267233

I think this is what you're looking for. It cycles the images ... affiliateX.gif and when you click on it the corresponding link opens up in a new window. It's set to every 6 seconds right now.

<html>

<head>



<script>

<!--

//EDIT FROM HERE...vvv

var timeDelay = 6; // change delay time in seconds



var Pix = new Array

("affiliates/affiliate1.gif"

,"affiliates/affiliate2.gif"

,"affiliates/affiliate3.gif"

,"affiliates/affiliate4.gif"

);



//specify corresponding links

var slidelinks=new Array

("http://www.affiliate1.com/"

,"http://www.affiliate2.com/"

,"http://www.affiliate3.com/"

,"http://www.affiliate4.com/"

);

// TO HERE...^^^



var howMany = Pix.length;

timeDelay *= 1000;

var PicCurrentNum = 0;

var PicCurrent = new Image();

PicCurrent.src = Pix[PicCurrentNum];



function startPix() {

setInterval("slideshow()", timeDelay);

}

function slideshow() {

PicCurrentNum++;

if (PicCurrentNum == howMany) {

PicCurrentNum = 0;

}

PicCurrent.src = Pix[PicCurrentNum];

document["ChangingPix"].src = PicCurrent.src;

}



function gotopage(){

window.open(slidelinks[PicCurrentNum])

}



// -->



</script>

</head>

<body>

<a href="../../unavailable.html">

<img src="../../unavailable.html" name="ChangingPix" width="200" height="75" border="0" id="ChangingPix">

</a>

</body>

</html>

#267238

That could be useful too; but I was looking for something that changed with each page reload as apposed to one with a time delay. Sorry, I wasn't very specific. :(

#267253

For links, adapt the quote one found on this page:

http://www.kathmann.com/up/

Use tags to make them links.

Hope this helps,

-NC

#267257