文字颜色渐变显示

文字颜色渐变显示

<HTML>    
<HEAD>    
<SCRIPT language=JavaScript>      
var   col   =   new   Array();      
col[15]   =   ‘#000000’;      
col[14]   =   ‘#111111’;      
col[13]   =   ‘#222222’;      
col[12]   =   ‘#333333’;      
col[11]   =   ‘#444444’;      
col[10]   =   ‘#555555’;      
col[9]   =    ‘#666666’;      
col[8]   =    ‘#777777’;      
col[7]   =    ‘#888888’;      
col[6]   =    ‘#999999’;      
col[5]   =    ‘#AAAAAA’;      
col[4]   =    ‘#BBBBBB’;      
col[3]   =    ‘#CCCCCC’;      
col[2]   =    ‘#DDDDDD’;      
col[1]   =    ‘#EEEEEE’;      
col[0]   =    ‘#FFFFFF’;      
var i = col.length;  
var isOut = true;   
function turn()   
{   
if (i>=0 && isOut) {
i–;lin.style.color=col[i];
}else if(i<= col.length && !isOut){
i++;lin.style.color=col[i];
}else{isOut = !isOut;}   
setTimeout(‘turn()’,200);//渐变   
}     
    
</SCRIPT>      
    
    
<TABLE><TBODY><TR><TD id=lin onclick=turn()>连接</TD></TR></TBODY></TABLE> <PRE></PRE>
</head>
</html>

留下回复