广告文字的显示


一段文字,效果类似逐字出现,很适合使用在提醒、广告效果上。

制作方法:
在<body>相关处插入代码:
<SCRIPT language=JavaScript1.2>
var message="欢迎你光临www.it365cn.com"
var neonbasecolor="#FFFFFF"
var neontextcolor="red"
var Flashspeed=200 //in milliseconds

var n=0
if (document.all){
document.write('<a href=http://2shou.sina.com.cn/ target=_blank><font color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight">'+message.charAt(m)+'</span>')
document.write('</font></a>')
//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>

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3