当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 荧光文字

HTML/XHTML教程
对联广告代码效果之二[鼠标感应]
对联广告代码效果之三[允许关闭]
禁止右键、Ctrl键和复制功能的JS代码
无刷新变换BANNER特效代码
计算鼠标所在位置的x,y坐标的JavaScript脚本
javascript: 改变和控制显示的图片大小(保持比例,同时可限制高宽)
限制文本输入框只能输入0-9数字
windows.open()参数列表
VBscript超强幻灯片效果代码
模仿MSN消息提示的效果
记录访客的来访次数
自动关闭弹出式窗口
状态栏特效
鼠标右键显隐效果
随鼠标的闪烁小星星
鼠标周围的文字宣传
荧光文字
点一下,首页地址添加到收藏夹
让弹出窗口变得“体贴”一些
如何制作浮动广告

HTML/XHTML教程 中的 荧光文字


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 43 ::
收藏到网摘: n/a

要完成此效果把如下代码加入到<body>区域中

<h2>
<script language="JavaScript1.2">

//下面设置显示效果的属性
var message="Welcome to JavaScript Fairyland!"
var neonbasecolor="gray"
var neontextcolor="33ff33"
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>