<br>텍스트 = "www.jb51.net"; <br>color1 = "녹색"; <br>color2 = "빨간색"; <br>속도 = 200; <br>나는 = 0; <br>if (navigator.appName == "Netscape") { <br>} <br>else { <br>document.write("<span id=a></span>"); <br>} <br>function changeCharColor() { <br>if (navigator.appName == "Netscape") { <br>document.a.document.write("<font color=" color1 ">" ); <br>for (var j = 0; j < text.length; j ) { <BR>if(j == i) { <BR>document.a.document.write("<font color=" color2 ">" Text.charAt(i) "</font>"); <br>} <br>else { <br>document.a.document.write(text.charAt(j)); <br>} <br>} <br>document.a.document.write('</font>'); <br>document.a.document.close(); <br>} <br>if (navigator.appName == "Microsoft Internet Explorer") { <br>str = "<font color=" color1 ">"; <br>for (var j = 0; j < text.length; j ) { <BR>if( j == i) { <BR>str = "<font color=" color2 ">" text.charAt(i) "</font>"; <br>} <br>else { <br>str = text.charAt(j); <br>} <br>} <br>str = "</font>"; <br>a.innerHTML = str; <br>} <br>(i == text.length) ? i=0 : i ; <br>} <br>setInterval("changeCharColor()", speed); <br>// 끝 --> <br> 运行效果 [Ctrl A 전체选 注:如需引入외부Js需刷新才能执行] text = "这里输入你要的文字 www.jb51.net"; color1 = "green"; color2 = "red"; speed = 200; i = 0; if (navigator.appName == "Netscape") { } else { document.write("<span id=a>"); } function changeCharColor() { if (navigator.appName == "Netscape") { document.a.document.write("<font color=" + color1 + ">"); for (var j = 0; j < text.length; j++) { if(j == i) { document.a.document.write("<font color=" + color2 + ">" + Text.charAt(i) + ""); } else { document.a.document.write(text.charAt(j)); } } document.a.document.write(''); document.a.document.close(); } if (navigator.appName == "Microsoft Internet Explorer") { str = "<font color=" + color1 + ">"; for (var j = 0; j < text.length; j++) { if( j == i) { str += "<font color=" + color2 + ">" + text.charAt(i) + ""; } else { str += text.charAt(j); } } str += ""; a.innerHTML = str; } (i == text.length) ? i=0 : i++; } setInterval("changeCharColor()", speed); // End -->