Home > Web Front-end > JS Tutorial > body text

Good text special effects, word by word color changing effect_Typical special effects

WBOY
Release: 2016-05-16 19:14:49
Original
1255 people have browsed it


text = "www.jb51.net";
color1 = "green"; 
color2 = "red";
speed = 200; 
i = 0;
if (navigator.appName == "Netscape") {
}
else {
document.write("");
}
function changeCharColor() {
if (navigator.appName == "Netscape") {
document.a.document.write("");
for (var j = 0; j < text.length; j ) {
if(j == i) {
document.a.document.write(""   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 = "";
for (var j = 0; j < text.length; j ) {
if( j == i) {
str  = ""   text.charAt(i)   "";
}
else {
str  = text.charAt(j);
}
}
str  = "";
a.innerHTML = str;
}
(i == text.length) ? i=0 : i ;
}
setInterval("changeCharColor()", speed);
// End -->

  
运行效果


[Ctrl A 全选 注:如需引入外部Js需刷新才能执行
]
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template