闪动的文字

本文介绍了一种使用JavaScript实现的霓虹灯闪烁文本效果。该效果通过改变文本颜色来模拟霓虹灯的闪烁,适用于网页标题或装饰文字。文章提供了完整的代码示例,包括如何设置文本内容、颜色及闪烁速度。
<h2>
<script language="JavaScript1.2">

/*
Neon Lights Text
By Website Abstraction (http://wsabstract.com)//原效果来自 
Over 400+ free scripts here!
*/
//下面设置显示效果的属性
var message="Welcome to Website Abstraction!"
var neonbasecolor="gray"
var neontextcolor="#00DD55"
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>

<align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><href="http://wsabstract.com">Website
Abstraction
</a></font></p>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值