WoW Gold - Synchronize your Files - High Paying Adsense List - Debt Consolidation - Find services

PDA

View Full Version : Rotate Html Links


sudduch
Aug 17th 2007, 11:06 pm
Hello Friends,

I need help in javascript to Rotate the links..say for ex.I have 5 links in my website and I need to vary these 5 links accordingly!!

Hope u understand my question.

Regards,
Suddu

hans
Aug 17th 2007, 11:15 pm
meanwhile you wait for a javascript solution

here a MOST simple php solution
a tiny script file stored inside the folder that contains small HTML ( or other files ) links from

I just saw that the original web site no longer exists and the forwarded URL has no such script - if interested I can help u with a copy of mine for free just EMAIL me directly if u wish so

will randomly select ANY of the files

I use the same script for my blog banner image - but the script works perfect for any other file extension as well

the script is called from within the file and location where you want the links ( images ) to be placed

sudduch
Aug 17th 2007, 11:25 pm
Hi,

How can I achieve the same thing using only html file.

Regards,
Suddu

hans
Aug 18th 2007, 12:44 am
emailed you the rotate php script
if only inserting links - then of course you create files and have only the link part of the CORRECT / validated HTML link-code in each file WITHOUT <head> section of the file.
best is to place the code within a <div> and give that <div> the desired formating using CSS

sudduch
Aug 19th 2007, 9:08 pm
Thank you I get your php script!! But I didn't get the exact output. I want it to be using html & Javascript could you suggest me with appropriate .

hans
Aug 20th 2007, 7:05 am
I am NOT into js
but since it displays whatever code you have in your random folders - it may as well be used for js - I guess you may have to do your own studying and testing

for HTML it does a perfect job

mjamesb
Aug 20th 2007, 6:01 pm
Not exactly sure what you are trying to do but this is a basic example of a script that will randomly rotate the contents of a div.

<body>
<div id="RotateLink"></div>


<script language="javascript">
var links = new Array("link1", "link2", "link3", "link4", "link5");
var randomnumber=Math.floor(Math.random()*5)
document.getElementById("RotateLink").innerHTML = links[randomnumber];
</script>
</body>

hans
Aug 20th 2007, 8:10 pm
such js scripts certainly work perfect
disadvantage however is
each time you add new links for random selection you have to change the script - in an external js script only once - if you have it on the page then on each page where you use this script.

while in the PHP script you just add links or link groups and have nothing to change in the script itself