Код скрипта
<html>
<head>
<title>Кнопка меняющая ссылки</title>
</head>
<body onLoad="window.StartTimer()">
<script LANGUAGE="JavaScript1.2">
<!--
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("The FreeHosting Index|http://www.freehostingindex.com",
"For your pleasure|http://www.freepicsindex.com",
"CNet|http://www.cnet.com",
"Yahoo|http://www.yahoo.com",
"CNBC TV|http://www.cnbc.com",
"Netscape|http://www.netscape.com",
"ABC News|http://www.abcnews.com",
"CNN|http://www.cnn.com",
"Netscape FTP Site|ftp://ftp.netscape.com",
"Feedback|mailto:nobody@nobody.com");
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);
}
//-->
</script>
</p><form>
<input TYPE="button" VALUE=" Клёвые линки " NAME="Destination" onClick="window.DestinationUrl()">
</form>
</body>
</html>