|
在网上冲浪时,经常会看到一些网页上有一些链接在不停地变色。其实要实现这种效果很简单,下面的这段JavaScript就能轻松地帮你实现。 把如下代码加入< body>区域中 < script language="JavaScript"> < !-- Begin function initArray() { for (var i = 0; i < initArray.arguments.length; i++) { this[i] = initArray.arguments[i]; } this.length = initArray.arguments.length; } var colors = new initArray( "red", "blue", DOUBLE_QUO TATIONgreen", "purple", "black", "tan", "red");//以上几行为设置字体的颜色 delay = .5; // 在这里设置颜色变化的速度 link = 0; vlink = 0; function linkDance() { link = (link+1)%colors.length; vlink = (vlink+1)%colors.length; document.linkColor = colors[link]; document.vlinkColor = colors[vlink]; setTimeout("linkDance()",delay*1000); } linkDance(); // End --> < /script> < br> < a href="http://www.ccidnet.com/school">电脑应用< /a> < a href="http://www.ccidnet.com/soft/">软件特供< /a> < a href="http://developer.ccidnet.com/pub/disp/Column?columnID=287">开发者频道< /a> < a href="http://network.ccidnet.com/pub/disp/Column?columnID=199">网络通信频道< /a>
|