Buttons are common in Web pages. However, you may not have seen the link using buttons. In this way, you can use buttons to create links, and the links in the buttons are constantly displayed. The results are very nice and can save page space. You have to give it a try!
Click here to view the effect
1. Add the following program code to the
<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 [I]
}
}
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 ("SCID Windows world | http://www.ccidnet.com/school/system ",
"SCID web surfing compass | http://www.ccidnet.com/school/net ",
"SCID Software Download Park | http://www.ccidnet.com/school/soft ",
"SCID Network Office Automation | http://www.ccidnet.com/school/office ",
"SCID software e school | http://www.ccidnet.com/school/software ",
"SCID network multimedia house | http://www.ccidnet.com/school/multimedia ",
"SCID network training and examination | http://www.ccidnet.com/school/exam ",
"SCID Network Computer dictionary | http://www.ccidnet.com/school/dict"
);
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>
Note: you can modify the link and description above. In the above section ('showtimer () ', 4000), 4000 is used to set the speed of changes between links. The smaller the number, the faster the speed.
2. Add the following code to the <body> area.
<FORM>
<Input type = "button" VALUE = "zhouqing" NAME = "goTo"
OnClick = "window. goToUrl ()">
</FORM>
3. Change the content in <body> to the following code.
<Body bgcolor = "# ffffff" onLoad = "window. startTimer ()">