Buttons | links
Use JavaScript to keep the link buttons constantly changing
Buttons are a kind of stuff that you can often see in a Web page. But you may not have seen a link with a button. This method that teaches you today, not only can use the button to make the link, and the link in the button can change the display continuously. The effect is very good-looking and can save the page space, really kill each other, quickly try it!
Click here to view the effect
First, add the following program code to < 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[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 ("Sadie Web Windows World |http://www.ccidnet.com/school/system/",
"Sadie Surfing Compass |http://www.ccidnet.com/school/net/",
"Sadie network software Download Park |http://www.ccidnet.com/school/soft/",
"Sadie Network office automation |http://www.ccidnet.com/school/office/",
"Sadie Net software E Academy |http://www.ccidnet.com/school/software/",
"Sadie Network Multimedia Home |http://www.ccidnet.com/school/multimedia/",
"Sadie Net Training and examination |http://www.ccidnet.com/school/exam/",
"Sadie Net computer big 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: The above links and instructions can be modified on their own, above (' Showtimer () ', 4000) in the 4000 is used to set the change between the link speed, the smaller the number of faster.
Second, add the following code to the < body > area.
< FORM >
< INPUT type= "button" value= "zhouqing" name= "GoTo"
>
</form >
Thirdly, the contents of < body > are changed to the following code.
< body bgcolor= "#ffffff" >