把下面的代码保存成一个js文件,例如:fade_link.js
var setall=new Array();
var cr,cg,cb;
window.onLoad=my_init();
function my_change(r,g,b,m){
if(setall[m]==0){
setall[m]=1;
cr=r;cg=g;cb=b;
my_change2(255,255,255,m);
}
}
function my_change2(r,g,b,m){
if(r>=cr || g>=cg || b>=cb){
block=eval("a"+m);
block.style.color="RGB("+r+","+g+","+b+")";
if(r>=cr) r-=7;
if(g>=cg) g-=7;
if(b>=cb) b-=7;
setTimeout("my_change2("+r+","+g+","+b+","+m+")",10);
}else{
setall[m]=0;
}
}
function my_init(){
color="0,0,0";
for(i=0;i<=my_item.length;i++){
setall[i]=0;
my_item[i].className="alltext";
my_item[i].innerHTML="<div id=a"+i+" style='color:RGB("+color+")' onMouseOver='my_change("+color+","+i+")'>"+my_item[i].innerHTML+"</div>";
}
}
然后,在你的页面的最后面添加:
<script src ="fade_link.js" ></script>
此外,还必须给你的超级连接添加一个标记类似下面的即可:
<a linke="aaa.htm"><div id=my_item>Test Fade Link</div></a>