类似荧光灯的文字效果

2012-03-24 02:29:20 | 【

文字可以从左到右的变换颜色,就像荧光灯一样

查看全部代码 View Code

直接在<body>区输入以下代码:

<h2 style="background-color:black">
<script language="JavaScript1.2">
 
        /*****************************************************
         *  Share JavaScript (http://www.ShareJS.com)
         * 使用此脚本程序,请保留此声明
         * 获取此脚本以及更多的JavaScript程序,请访问 http://www.ShareJS.com
         ******************************************************/
     
//下面设置显示效果的属性
var message="欢迎分享JavaScript ShareJS.com!"
var neonbasecolor="gray"; //文字原有颜色
var neontextcolor="yellow"; //要变换的颜色
var flashspeed=100  //in milliseconds; //颜色变换频率
 
///No need to edit below this line/////
 
var n=0
if (document.all){
document.write('<font color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight">'+message.charAt(m)+'</span>'); //输出效果
document.write('</font>')
 
//cache reference to neonlight array
var tempref=document.all.neonlight
}
else
document.write(message)
 
function neon(){
 
//Change all letters to base color
if (n==0){
for (m=0;m<message.length;m++)
tempref[m].style.color=neonbasecolor
}
 
//cycle through and change individual letters to neon color
tempref[n].style.color=neontextcolor
 
if (n<tempref.length-1)
n++
else{
n=0
clearInterval(flashing)
setTimeout("beginneon()",1500)
return
}
}
 
function beginneon(){
if (document.all)
flashing=setInterval("neon()",flashspeed)
}
beginneon()
 
 
</script>
</h2>

下载"类似荧光灯的文字效果"

  • 本地下载
  • 本地下载2
热门标签:

相关资源