简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

文字逐个变色

来源:易贤网   阅读:690 次  日期:2016-06-20 11:00:25

温馨提示:易贤网小编为您整理了“文字逐个变色”,方便广大网友查阅!

脚本说明:

把如下代码加入<body>区域中:

<script language=javascript>

<!-- begin

text = 欢迎光临网站制作学习网; //显示的文字

color1 = blue; //文字的颜色

color2 = red; //转换的颜色

fontsize = 6; //字体大小

speed = 100; //转换速度 (1000 = 1 秒)

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>

更多信息请查看脚本栏目
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:常用的jquery模板插件
下一篇:title颜色样式
易贤网手机网站地址:文字逐个变色
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!