日期:2014-05-16  浏览次数:20371 次

Jscript闪现五彩颜色字体
<html>
<title>akuoma五彩颜色字体请看这里有木有</title>
<Script language="JavaScript">
	var color10 = new Array("yellow", "brass", "copper", "blueviolet", "green", "olivedrab", "scarlet", "royalblue", "coral", "plum");
	var newColor;
	function ColorChar(val, newText, i) {
		var obj = document.getElementById(val);
		var text = obj.title;
		var nTextArry = obj.innerHTML.split("</FONT>");
		if (Number(i) > text.length) {
			i = 0;
			newText = "";
		}
		newColor = color10[Math.floor(Math.random() * color10.length)];
		var achar = text.charAt(Number(i));
		i = Number(i) + 1;
		newText = newText + "<FONT color='" + newColor + "'>" + achar + "</FONT>";
		if (nTextArry.length < text.length) {				
			obj.innerHTML = newText + text.substr(Number(i));
		}
		else {
			var fstr = "";
			for (j = i; j < nTextArry.length; j++) {	 				
				if (nTextArry[j] != "" && j < text.length) {
					if (nTextArry[j].indexOf("<FONT") >= 0) {
						fstr = fstr + nTextArry[j] + "</FONT>";
					}
					else {
						fstr = fstr + text.substr(Number(i));
					}
				}
			}
			obj.innerHTML = newText + fstr;
		}	 		
		setTimeout("ColorChar('" + val + "',\"" + newText + "\"," + i + ")", 200);
	}
</SCRIPT>
<body onload="ColorChar('hltest','',0);">
				
<div id="textDiv"></div>   
<a href="#" id="hltest" name="hltest" style=" font-weight:bold;" title="akuoma五彩颜色字体请看这里有木有"> akuoma五彩颜色字体请看这里有木有</a>
<a href="#" id="A1" name="hltest" style=" font-weight:bold;" title="akuoma五彩颜色字体请看这里有木有"> akuoma五彩颜色字体请看这里有木有</a>
</body>
</html>