色彩变幻的链接

  • 来源: 学赛网 作者: 若水   2008-05-04/11:22
  • 色彩自动变换的链节,效果很赞,就是代码比较长。

    <HTML>
    <HEAD>
    <TITLE>Dynamic Link Color Changer</TITLE>
    </HEAD>
    <script Language="Javascript">
    bname=navigator.appName;
    bversion=parseInt(navigator.appVersion)
    var z=0;
    var rgb=0;
    var message= new Array();
    var value=0;
    var timer1;
    var timer2;
    var timer3;
    var convert = new Array()
    var hexbase= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
    //Do not edit anything else in the script except the lines below
    var bgcolor="#FF0000"; //Fade color
    var color="#0000FF";  //Starting color
    var speed=55
    //Do not edit anything else in the script except the lines above
    for (x=0; x<16; x++){
    for (y=0; y<16; y++){
      convert[value]= hexbase[x] + hexbase[y];
      value++;
    }
    }
    redx=color.substring(1,3);
    greenx=color.substring(3,5);
    bluex=color.substring(5,7);
    hred=eval(parseInt(redx,16));
    hgreen=eval(parseInt(greenx,16));
    hblue=eval(parseInt(bluex,16));
    eredx=bgcolor.substring(1,3);
    egreenx=bgcolor.substring(3,5);
    ebluex=bgcolor.substring(5,7);
    ered=eval(parseInt(eredx,16));
    egreen=eval(parseInt(egreenx,16));
    eblue=eval(parseInt(ebluex,16));
    red=ered;
    green=egreen;
    blue=eblue;
    function start(){
    timer1=window.setInterval('up()',speed)
    }
    function up(){
    if (red<hred){
      if ((red+15)<hred){
       red+=15;
       redx = convert[red]
      }
      else{
       red=hred
       redx = convert[red]
      }
    }
    if (red>hred){
      if ((red-15)>hred){
       red-=15;
       redx = convert[red]
      }
      else{
       red=hred
       redx = convert[red]
      }
    }
    if (green<hgreen){
      if ((green+15)<hgreen){
       green+=15;
       greenx = convert[green]
      }
      else{
       green=hgreen
       greenx = convert[green]
      }
    }
    if (green>hgreen){
      if ((green-15)>hgreen){
       green-=15;
       greenx = convert[green]
      }
      else{
       green=hgreen
       greenx = convert[green]
      }
    }
    if (blue<hblue){
      if ((blue+15)<hblue){
       blue+=15;
       bluex = convert[blue]
      }
      else{
       blue=hblue
       bluex = convert[blue]
      }
    }
    if (blue>hblue){
      if ((blue-15)>hblue){
       blue-=15;
       bluex = convert[blue]
      }
      else{
       blue=hblue
       bluex = convert[blue]
      }
    }
    rgb = "#"+redx+greenx+bluex;
    document.linkColor=rgb;
    document.vlinkColor=rgb;
    if (z>19){
      window.clearInterval(timer1);
      timer2=window.setInterval('down()',speed)
    }
    else
    z++
    }
    function down(){
    if (red<ered){
      if ((red+15)<ered){
       red+=15;
       redx = convert[red]
      }
      else{
       red=ered
       redx = convert[red]
      }
    }
    if (red>ered){
      if ((red-15)>ered){
       red-=15;
       redx = convert[red]
      }
      else{
       red=ered
       redx = convert[red]
      }
    }
    if (green<egreen){
      if ((green+15)<egreen){
       green+=15;
       greenx = convert[green]
      }
      else{
       green=egreen
       greenx = convert[green]#p#分页标题#e#
      }
    }
    if (green>egreen){
      if ((green-15)>egreen){
       green-=15;
       greenx = convert[green]
      }
      else{
       green=egreen
       greenx = convert[green]
      }
    }
    if (blue<eblue){
      if ((blue+15)<eblue){
       blue+=15;
       bluex = convert[blue]
      }
      else{
       blue=eblue
       bluex = convert[blue]
      }
    }
    if (blue>eblue){
      if ((blue-15)>eblue){
       blue-=15;
       bluex = convert[blue]
      }
      else{
       blue=eblue
       bluex = convert[blue]
      }
    }
    rgb = "#"+redx+greenx+bluex;
    document.linkColor=rgb;
    document.vlinkColor=rgb;
    if (z>38){
      z=0;
      window.clearInterval(timer2);
    timer1=window.setInterval('up()',speed);
    }
    else
    z++
    }
    // done hiding -->
    </script>
    <BODY BGCOLOR="#000000" LINK="#FF0000" VLINK="#FF0000" ALINK="#FFFF00" TEXT="#FFFFFF" onLoad="start()">
    <CENTER><a href="http://help.educity.cn/">网络世界特效无限</a><BR></CENTER>
    </BODY>
    </HTML>


    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多