打字机效果

[ Time:2007/03/05 14:14 ]
[html]

<SCRIPT language=JavaScript1.2>
var message="  情感,是一种习惯,是一种依恋,是一种无语的挂牵,不管时间如何交错,却并不曾凝固了这淡淡的情结,随手敲开的依然是我默默牵挂的这一片温馨情怀。"
var neonbasecolor="#c09450"
var neontextcolor="#006600"
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><BR><br>')
//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>
[/html]
| |