The ever popular codes for the button and the flashy links.

1 Conversation

I keep getting asked how to do them, so I decided to put up a page on it. Please tell me if you've used the codes, cos.. I wanna know!

For the changy colours, put the following code (I don't recommend altering it) after the <BODY> tag in your page.
From here -

<!-- 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>

to here.












For the button, you need to put the following code after the <BODY> tag as well..

Here-
<SCRIPT language="JavaScript">

var alerted_already;
var remark;
function theytyped(form) {
for ( j = 1;
j<=remark.length && remark[j]!=form.myoutxt.value;
j++){}
if (j>remark.length)
form.myoutxt.value = "Do not type here!";
return false;
}
function touched_frog() {
if (!alerted_already) {
alert(""+
""+
""+
""+
""+
"");
alerted_already = true;
}
return alerted_already;
}
function compute(form) {
for (var i = 1;
i<=remark.length && remark[i]!=form.myoutxt.value ;
i++){}
if (i==remark.length)
history.back();
if (i==remark.length-1) alert("Dear Sir or Madam:"+

"\n\n It has come to our attention that you have been harassing"+

"\none of the buttons on the web. Although most buttons are"+

"\nunderstanding about this type of thing (being repeatedly pressed),"+

"\nsome rogue buttons have decided to form a support group and have"+

"\npetitioned the webmaster for funds to provide a secure place for"+

"\nrest and relaxation. Due to the large number of requests, this"+

"\nwarning has been installed:"+

"\n IF YOU PERSIST PRESSING THIS BUTTON,"+

"\nYOU WILL BE EJECTED FROM THIS SCREEN."+

"\n\n Thank you for your cooperation,"+

"\n\n The Federation for Oppressed and Abused Buttons"+

"\n\nenclosure: Message from oppressed complaintant"+

"\n\nDear Federation for Oppressed and Abused Buttons"+

"\n\n As I have been able to secure your assistance before,"+

"\nI beg your help in stopping the on going abuse I am once again"+

"\nforced to endure. THIS GUY WILL NOT STOP!"+

"\n\n Sincerely"+

"\n\n Push Me"+

"\n\np.s. I will definitely attend the annual meeting next July");
if (i<remark.length)
form.myoutxt.value = remark[i+1];
else
form.myoutxt.value = remark[1];
}
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++)
this[i+1] = initArray.arguments[i];
}
remark = new initArray("Thanks!",

"Once is enough!",

"Are you deaf?",

"Go!!..Go back to H2G2!!",

"PISS OFF!",

"I give up. Please stop.",

"I DID say please!!!",

"O.K. I HEARD YOU!",

"This is NOT funny!",

"I give up.",

"This is now a BACK BUTTON!!!!");
alerted_already = false;
//
</SCRIPT>
to here.



And you put the following script wherever you want the button to go.

From here-

<FORM onsubmit="return false" method="post" id="buttons">
<INPUT id="pushme" onmouseover="window.status='LEAVE ME ALONE!';
return touched_frog()" type="button" onclick="compute(this.form)" value="Push Me">
<INPUT id="myoutxt" onblur="theytyped(this.form)" type="text" onchange="theytyped(this.form)" size="35" onfocus="theytyped(this.form)" value=" ">
</FORM>
to here.

PS I don't recommend leaving the "from here to here" bits in either!!

Good luck!

Bookmark on your Personal Space


Conversations About This Entry

Title
Latest Post

Entry

A243721

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

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