<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
bg_color = "black";
neon_color = "yellow";
num = 0;
num2 = 0;
num3 = 0;
num4 = neon_color;
function init_neon() {
message = neon.innerText;
neon.innerText = "";
for(i = 0; i != message.length; i++) {
neon.innerHTML += "<span id=\"neond\" style=\"color:"+bg_color+"\">"+message.charAt(i)+"<\/span>";
}
neon_A();
}
function neon_A() {
if(num != message.length) {
document.all.neond[num].style.color = neon_color;
num++;
setTimeout("neon_A()", 100);
}
else {
num = 0;
num2 = message.length;
setTimeout("neon_B()", 2000);
}
}
function neon_B() {
document.all.neond[num].style.color = bg_color;
document.all.neond[num2-1].style.color = bg_color;
if(Math.floor(message.length / 2) + 1 != num2) {
num++;
num2--;
setTimeout("neon_B()", 50);
}
else {
setTimeout("neon_C()", 50);
}
}
function neon_C() {
if(num3 != message.length && num3 != message.length+1) {
document.all.neond[num3].style.color = neon_color;
num3 = num3 + 2;
setTimeout("neon_C()",100);
}
else {
setTimeout("neon_D()", 50);
}
}
function neon_D() {
if(num3 == message.length) {
num3++;
neon_E();
}
else {
num3--;
neon_E();
}
}
function neon_E() {
if(num3 != 1) {
num3 = num3 - 2;
document.all.neond[num3].style.color = neon_color;
setTimeout("neon_E()", 100);
}
else {
if(num4 == neon_color) {
num3 = 0;
neon_color = bg_color;
setTimeout("neon_C()", 2000);
}
else {
neon_color = num4;
num3 = 0;
setTimeout("neon_F()", 50);
}
}
}
function neon_F() {
document.all.neond[num].style.color = neon_color;
document.all.neond[num2 - 1].style.color = neon_color;
if(message.length != num2) {
num--;
num2++;
setTimeout("neon_F()", 50);
}
else {
num = 0;
num2 = 0;
setTimeout("neon_G()", 2000);
}
}
function neon_G() {
if(num != message.length) {
document.all.neond[num].style.color = bg_color;
num++;
setTimeout("neon_G()", 100);
}
else {
num = 0;
neon_A();
}
}
//-->
</SCRIPT>
</HEAD>
<BODY onLoad="init_neon()">
<h2><span id="neon">JavaScript★Tips</span></h2>
</BODY>
</HTML>
|