Forum Moderators: mack

Message Too Old, No Replies

Hyperlink Rotation

How to get hyperlinks to move in different order?

         

Sunnydale

1:29 pm on Jan 26, 2006 (gmt 0)

10+ Year Member



I want a group list of hyperlinks to rotate in a different order each time the page loads.
E.g
hyperlink1
hyperlink2
hyperlink3

Moves to:

hyperlink3
hyperlink1
hyperlink2

I've seen this on some sites but cannot make out how to do this?
Any thoughts will be most helpful!

httpwebwitch

9:55 am on Jan 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



put your hyperlinks into a javascript array.

then you can "rotate" or "shuffle" the array. there are plenty of free javascript tutorials on the www to show you this.

once the array is jumbled, iterate through it with a FOR loop to write them on the page.

jfodale

5:30 pm on Jan 27, 2006 (gmt 0)

10+ Year Member



Yep, or do it server side with PHP (same method basically).

httpwebwitch

6:48 pm on Jan 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP is a better idea, do it that way if you can

Sunnydale

7:05 pm on Jan 27, 2006 (gmt 0)

10+ Year Member



Thanks for the help. I'll try it out.