본문 바로가기

javascript

글자에 네온효과를 주며 덮어 씁니다

공지창 등에 사용하면 좋을듯 합니다. 글자를 다른 색상으로 덮어가며 스크롤되는 네온 텍스트 효과 입니다

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Script </title>
<meta http-equiv=content-type content=text/html; charset=euc-kr>
</head>

<body bgcolor=black>

<h2 align=center>

<!---- 아래와 같은 방법으로 태그와 코드를 원하는 위치에 복사 해 넣으세요 --->

<script language="JavaScript1.2">
var message="Welcome to JavaScript Source Bank" // 원하는 메세지
var neonbasecolor="gray" // 기본글자 색상
var neontextcolor="yellow" // 네온글자 색상
var flashspeed=100  // 스피드를 조절 할 수 있습니다

var n=0
if (document.all){
document.write('<font face=\"Arial Black\" color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight">'+message.charAt(m)+'</span>')
document.write('</font>')

var tempref=document.all.neonlight
}
else
document.write(message)

function neon(){
if (n==0){
for (m=0;m<message.length;m++)
tempref[m].style.color=neonbasecolor
}

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>

</body>
</html>