手机
当前位置:查字典教程网 >网页设计 >脚本HTML教程 >文字逐渐变换颜色
文字逐渐变换颜色
摘要:网页特效|Linkweb.cn/Js|---文字逐渐变换颜色

 <html>

<head>
<title>网页特效|Linkweb.cn/Js|---文字逐渐变换颜色</title>
</head><body>
<!--将以下代码加入HTML的<Body></Body>之间-->
<SCRIPT language=JavaScript>
<!-- Begin
text = "网页特效梦工厂"
color1 = "0000FF";
color2 = "FF0000";
fontsize = "4";
speed = 100;
i = 0;
if (navigator.appName == "Netscape") {
document.write("<layer id=a visibility=show></layer><br><br><br>");
}
else {
document.write("<div id=a></div>");
}
function changeCharColor() {
if (navigator.appName == "Netscape") {
document.a.document.write("<center><font face=arial size =" + fontsize + "><font color=" + color1 + 
">");
for (var j = 0; j < text.length; j++) {
if(j == i) {
document.a.document.write("<font face=arial color=" + color2 + ">" + Text.charAt(i) + "</font>");
}
else {
document.a.document.write(text.charAt(j));
}
}
document.a.document.write('</font></font></center>');
document.a.document.close();
}
if (navigator.appName == "Microsoft Internet Explorer") {
str = "<center><font face=arial size=" + fontsize + "><font color=" + color1 + ">";
for (var j = 0; j < text.length; j++) {
if( j == i) {
str += "<font face=arial color=" + color2 + ">" + text.charAt(i) + "</font>";
}
else {
str += text.charAt(j);
}
}
str += "</font></font></center>";
a.innerHTML = str;
}
(i == text.length) ? i=0 : i++;
}
setInterval("changeCharColor()", speed);
// End -->
</SCRIPT>
</body></html>

【文字逐渐变换颜色】相关文章:

在HTML中利用js调用php的内容

彩虹文字

旋转文字

HTML基本标签有哪些

python实现挑选出来100以内的质数

html中有亲和力的文字隐藏方法

html标签语义化

html元素水平居中、垂直居中、水平垂直居中于其父级元素的方法

HTML元素:isindex

HTML减少图像的颜色数

精品推荐
分类导航