Dancing Link Colours

4 Conversations



The colour of this link should change before your very eyes (Netscape users: click Refresh to see it change).

How you do dat?

Paste everything between the horizontal lines, after the <BODY> tag of your home page source:

<!-- Cut-N-Paste JavaScript from ISN Toolbox
Copyright 1996, Infohiway, Inc. Restricted use is hereby
granted (commercial and personal OK) so long as this code
is not *directly* sold and the copyright notice is buried
somewhere deep in your HTML document. A link to our site
http://www.infohiway.com is always appreciated of course,
but is absolutely and positively not necessary. -->

<script language="JavaScript">
<!--
function initArray() {
for (var i = 0; i < initArray.arguments.length; i++) {
this[i] = initArray.arguments[i];
}
this.length = initArray.arguments.length;
}

// you may fill this colors array with your colors.
// the script will rotate the links through these colors
var colors = new initArray(
"#ffffff",
"#ffffef",
"#ffffdf",
"#ffffcf",
"#ffffbf",
"#ffffaf",
"#ffff9f",
"#ffff8f",
"#ffff7f",
"#ffef7f",
"#ffdf7f",
"#ffcf7f",
"#ffbf7f",
"#ffaf7f",
"#ff9f7f",
"#ff8f7f",
"#ff7f7f",
"#ff7f8f",
"#ff7f9f",
"#ff7faf",
"#ff7fbf",
"#ff7fcf",
"#ff7fdf",
"#ff7fef",
"#ff7fff",
"#ff8fff",
"#ff9fff",
"#ffafff",
"#ffbfff",
"#ffcfff",
"#ffdfff",
"#ffefff");

pause_time = .3; // in seconds

link = 0; // starting color index (in colors array) for unvisited links
vlink = 4; // starting color index (in colors array) for visited links

function linkDance() {
link = (link+1)%colors.length;
vlink = (vlink+1)%colors.length;
//alert("link "+link+"\r\nvlink "+vlink+"\r\nvlinkColor "+document.vlinkColor);
document.linkColor = colors[link];
document.vlinkColor = colors[vlink];
setTimeout("linkDance();",pause_time*1000);
}
linkDance();
// -->
</script>

IMPORTANT: Please remember the copyright notice. You like the script? Then support the guys who wrote it!

Bookmark on your Personal Space


Entry

A167870

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


References

External Links

Not Panicking Ltd is not responsible for the content of external internet sites

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more