随机链接按钮


<!--One step to installing this script-->

<!--1) Simply add the below to your BODY:-->



<script LANGUAGE="JavaScript1.2">

<!--



/*

For this script, visit

http://java-scripts.net or http://wsabstract.com

*/



var WhereTo = null;

var TimerID = null;

var now = new Date();

var pos = 0;

var StartTime = null;

var PauseTime = 3000;

// Change the PauseTime value (in milliseconds) to

// change the speed at which the button URLs rotate.



function InitializeArray() {

this.length = InitializeArray.arguments.length

for (var i = 0; i < this.length; i++)

{

this[i+1] = InitializeArray.arguments[i]

}

}



function ParseString(data,num) {

for(var i=0;i<data.length;i++)

{

if(data.substring(i,i+1)=="|") break;

}

if (num==0) return(data.substring(0,i));

else return(data.substring(i+1,data.length));

}



function StartTimer() {

now = new Date();

StartTime=now.getTime();

StopTimer();

WhereTo = new InitializeArray("Java-Scripts.net|http://www.java-scripts.net",

"Free-Backgrounds|http://www.free-backgrounds.com",

"Website Abstraction|http://www.wsabstract.com",

"Dynamic Drive|http://www.dynamicdrive.com",

"MSNBC.com|http://www.msnbc.com",

"Geocities|http://www.geocities.com",

"CodeArena.com|http://www.codearena.com",

"Email Us|george@java-scripts.net");

ShowTimer();

}



function StopTimer() {

TimerID = null;

WhereTo = null;

}



function ShowTimer() {

pos= (pos == WhereTo.length) ? 1 : pos + 1;

document.forms[0].elements[0].value=ParseString(WhereTo[pos],0);

TimerID=window.setTimeout('ShowTimer()',PauseTime);

}



function DestinationUrl() {

this.location=ParseString(WhereTo[pos],1);

return (false);

}



window.onload=window.StartTimer

//-->

</script>



<form>

<div align="center"><center><p><input TYPE="button" VALUE=" Cool Links! "

NAME="Destination" onClick="window.DestinationUrl()">

</form>