看看这段你能用上不?
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>链接效果</title>
<script>
var rate = 20;  
var obj;        
var act = 0;    
var elmH = 0;   
var elmS = 128; 
var elmV = 255; 
var clrOrg;   
var TimerID;  
if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {
    Browser = true;
} else {
    Browser = false;
}if (Browser) {
    document.onmouseover = doRainbowAnchor;
    document.onmouseout = stopRainbowAnchor;
}
function doRainbow()
{
    if (Browser && act != 1) {
        act = 1;
        obj = event.srcElement;
        clrOrg = obj.style.color;
        TimerID = setInterval("ChangeColor()",100);
    }
}function stopRainbow()
{
    if (Browser && act != 0) {
        obj.style.color = clrOrg;
        clearInterval(TimerID);
        act = 0;
    }
}
function doRainbowAnchor()
{
    if (Browser && act != 1) {
        obj = event.srcElement;        while (obj.tagName != 'A' && obj.tagName != 'BODY') {
            obj = obj.parentElement;
            if (obj.tagName == 'A' || obj.tagName == 'BODY')
                break;
        }        if (obj.tagName == 'A' && obj.href != '') {
            act = 1;
            clrOrg = obj.style.color;
            TimerID = setInterval("ChangeColor()",100);
        }
    }
}
function stopRainbowAnchor()
{
    if (Browser && act != 0) {
        if (obj.tagName == 'A') {
            obj.style.color = clrOrg;
            clearInterval(TimerID);
            act = 0;
        }
    }
}
function ChangeColor()
{
    obj.style.color = makeColor();
}function makeColor()
{
  
    if (elmS == 0) {
        elmR = elmV;    elmG = elmV;    elmB = elmV;
    }
    else {
        t1 = elmV;
        t2 = (255 - elmS) * elmV / 255;
        t3 = elmH % 60;
        t3 = (t1 - t2) * t3 / 60;        if (elmH < 60) {
            elmR = t1;  elmB = t2;  elmG = t2 + t3;
        }
        else if (elmH < 120) {
            elmG = t1;  elmB = t2;  elmR = t1 - t3;
        }
        else if (elmH < 180) {
            elmG = t1;  elmR = t2;  elmB = t2 + t3;
        }
        else if (elmH < 240) {
            elmB = t1;  elmR = t2;  elmG = t1 - t3;
        }
        else if (elmH < 300) {
            elmB = t1;  elmG = t2;  elmR = t2 + t3;
        }
        else if (elmH < 360) {
            elmR = t1;  elmG = t2;  elmB = t1 - t3;
        }
        else {
            elmR = 0;   elmG = 0;   elmB = 0;
        }
    }    elmR = Math.floor(elmR);
    elmG = Math.floor(elmG);
    elmB = Math.floor(elmB);    clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);    elmH = elmH + rate;
    if (elmH >= 360)
        elmH = 0;    return clrRGB;
}
</script></head><body>
<a href="link.htm" target="_blank">链接效果</a>
</body></html>

解决方案 »

  1.   

    这个和你要的差不多了。要完成此效果把如下代码加入到<body>区域中<SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    IE = (document.all);
    if (IE) {
      var chidc = new Array();
      var hexc = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
      var chidn = new Array(100,70,40);
      var step = new Array(10,10,10);
      var chway = new Array(step[0],step[1],step[2]);
      var tone = new Array(1,1,1);
      function chcol() {
        for (i=0; i<3; i++) {
          chidn[i]+=chway[i];
          if (chidn[i]>=255) {
            chidn[i] = 255;
            chway[i] = -step[i];
          }
        else if (chidn[i]<=40) {
            chidn[i] = 40;
            chway[i] = step[i];
            tone[i]>=3? tone[i] = 1:tone[i]++;
          }
          col1 = hexc[Math.floor(chidn[i]/16)];
          col2 = hexc[chidn[i]%16];
          tored = '';
          toblue = '';
          for (j=1; j<tone[i]; j++) tored+='00';
          for (j=3; j>tone[i]; j--) toblue+='00';
          chidc[i] = '#'+tored+col1+col2+toblue;
          td = eval('document.all.chcol'+i);
          td.style.backgroundColor = chidc[i];
        }
        setTimeout('chcol()',100);
      }
    }
    //  End -->
    </script>
    <table cellspacing=2 cellpadding=0 bgcolor=#999999 width=300>
    <tr>
    <td width=33% align=center id=chcol0 name=id=chcol0>
    <font color=white>Left</td>
    <td width=33% align=center id=chcol1 name=id=chcol0>
    <font color=white>To</td>
    <td width=33% align=center id=chcol2 name=id=chcol0>
    <font color=white>Right</td>
    </tr>
    </table>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    chcol();
    //  End -->
    </script>
      

  2.   

    Text.charAt(i)
    改为:
    text.charAt(i)