인터넷정보

텍스트 네온 효과

알 수 없는 사용자 2007. 10. 18. 14:11
<script language="JavaScript1.2">
var message="하늘다래 짜~앙 히히힛"  // 보여질 메세지
var neonbasecolor="#46C6E7" // 기본 글자색
var neontextcolor="#EE9DB3" //변할 글자색
var neontextcolor2="#46C6E7" //기본 글자색
var flashspeed=150 //속도
var flashingletters=3 // 몇글자씩 변할지
var flashingletters2=1
var flashpause=0

var n=0
if (document.all||document.getElementById){
document.write('<font color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>')
document.write('</font>')
}
else
document.write(message)

function crossref(number){
var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById
("neonlight"+number)
return crossobj
}

function neon(){

if (n==0){
for (m=0;m<message.length;m++)
crossref(m).style.color=neonbasecolor
}

crossref(n).style.color=neontextcolor

if (n>flashingletters-1) crossref(n-flashingletters).style.color=neontextcolor2
if (n>(flashingletters+flashingletters2)-1) crossref(n-flashingletters-flashingletters2).style.color=neonbasecolor


if (n<message.length-1)
n++
else{
n=0
clearInterval(flashing)
setTimeout("beginneon()",flashpause)
return
}
}

function beginneon(){
if (document.all||document.getElementById)
flashing=setInterval("neon()",flashspeed)
}
beginneon()
</script>
반응형