Nice links switcher - How is it called?

K

Kerberos

I found an interesting "menu", I don't know how you call it. It displays a
link for 2 seconds, then it displays another link for 2 seconds, and so
on. Here it is: http://www.alibaba.com under "Browse Trade Leads".

I found that it doesn't work with major browsers (If you try it, please
use IE, as it works only on IE, sorry).
Do you know a JavaScript that does just that but is cross-browser?
Thanks,

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http://www.osresources.com
http://exodus.jabberstudio.org
 
R

Robert

It displays a link for 2 seconds, then it
displays another link for 2 seconds, and so on.

Try this html file. Let me know if you have any questions.

I didn't actually a changing link in the site you mentioned. Maybe the
links don't change on a Mac. So, I am guessing here!



Robert

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Changing Links</title>

<script type="text/javascript">
function changeLink(label)
{
links = [ "<a href='http://www.yahoo.com'>Yahoo</a>",
"<a href='http://www.google.com'>Google</a>",
"<a href='http://www.ebay.com'>Ebay</a>" ];
var node;

// Set a starting index for the links array
if ( typeof changeLink.index == "undefined" )
{ changeLink.index = 0; }

if (document.getElementById)
{
node = document.getElementById(label);
if (node)
{
newLink(node);
}
else
{
alert("You need to create a span tag with " +

"the id of " + label + ".");
return;
}
}
else
{
if (document.all)
{
node = document.all[label];
newLink(node);
}
else
{
alert("Constructs document.getElementByID " +
"and document.all failed. " +
"You need to use a newer browser.");
return;
}
}

function newLink(node)
{
node.innerHTML = links[changeLink.index++];
changeLink.index %= links.length;

setTimeout("changeLink('newlink')",3000);
}

}
</script>
</head>
<body>
<p>Change a link.</p>
<span id="newlink"><a
href="http://www.apple.com">Apple</a></span>
<br>
<p>When the "Change links" button is
pressed, the link will change every three seconds.
<form>
<input type="button"
name="activate"
value="Change links"
onclick="changeLink('newlink')">
</form>
</p>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top