|
楼主 |
发表于 2005-8-29 10:58:02
|
显示全部楼层
脚本说明:
第一步:把如下代码加入<head>区域中(你可以对链接及说明作相应修改)
<SCRIPT LANGUAGE="JavaScript">
<!-- begin
// please help yourself to this code.
var startTime =null;
var timerID =null;
var initial =new Date();
var pos =0;
var menuItem =null;
function initArray() {
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++) {
this[i+1] = initArray.arguments
}
}
function parsemenuItem(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() {
initial = new Date();
startTime=initial.getTime();
stopTimer();
menuItem = new initArray("Netscape|http://www.netscape.com",
"Microsoft|http://www.microsoft.com",
"IBM|http://www.ibm.com",
"Yahoo|http://www.yahoo.com",
"Excite|http://www.excite.com",
"Hotbot|http://www.hotbot.com",
"GrapeJam|http://www.grapejam.com",
"Email|mailto:rzeitel@mars.superlink.net"
);
showTimer();
}
function stopTimer() {
timerID=null;
menuItem=null;
//clearTimeout(timerID);
}
function showTimer() {
pos= (pos == menuItem.length) ? 1 : pos + 1;
document.forms[0].elements[0].value=parsemenuItem(menuItem[pos],0);
timerID=window.setTimeout('showTimer()',4000);
}
function goToUrl() {
//parent.welcome.location=parsemenuItem(menuItem[pos],1);
this.location=parsemenuItem(menuItem[pos],1);
return (false);
}
// end -->
</SCRIPT>
第二步:把如下代码加入<body>区域中
<FORM>
<INPUT TYPE="button" VALUE=" WHERE TO? " NAME="goTo"
onClick="window.goToUrl()">
</FORM>
第三步:把<body>中的内容改为:
<body bgcolor="#fef4d9" onLoad="window.startTimer()"> |
|