Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Nice links switcher - How is it called?

Reply
Thread Tools

Nice links switcher - How is it called?

 
 
Kerberos
Guest
Posts: n/a
 
      01-10-2005
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
 
Reply With Quote
 
 
 
 
Robert
Guest
Posts: n/a
 
      01-12-2005
>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>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
where can I find a connection switcher FireBrick Wireless Networking 3 08-27-2004 02:26 PM
ASP.net Version Switcher Frank J. Reashore ASP .Net 1 08-07-2004 07:09 PM
alistaprtstyle switcher, works but kills my default style :O( Hardeep Rakhra HTML 11 01-16-2004 04:50 PM
Javascript Style Switcher that remebers current site style in use Hardeep Rakhra HTML 8 01-15-2004 08:00 PM



Advertisments