不错的文字特效,逐字变色效果

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

不错的文字特效,逐字变色效果

  2020-05-12 我要评论
<font color="#669900" style="font-weight:bolder;letter-spacing: 2px;"><script language="JavaScript">
text = "www.qb5200.com";
color1 = "green"; 
color2 = "red";
speed = 200; 
i = 0;
if (navigator.appName == "Netscape") {
}
else {
document.write("<span id=a></span>");
}
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) + "</font>");
}
else {
document.a.document.write(text.charAt(j));
}
}
document.a.document.write('</font>');
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) + "</font>";
}
else {
str += text.charAt(j);
}
}
str += "</font>";
a.innerHTML = str;
}
(i == text.length) ? i=0 : i++;
}
setInterval("changeCharColor()", speed);
// End -->
</script>
</font>  
运行效果

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们