var thissize=20
|
聲明一個(gè)變量,定義字符串長度。 |
var textfont="隸書" |
聲明一個(gè)變量,定義字體。 |
var textcolor= new Array()
textcolor[0]="000000"
textcolor[1]="000000"
textcolor[2]="000000"
textcolor[3]="111111"
textcolor[4]="222222"
textcolor[5]="333333"
textcolor[6]="444444"
textcolor[7]="555555"
textcolor[8]="666666"
textcolor[9]="777777"
textcolor[10]="888888"
textcolor[11]="999999"
textcolor[12]="aaaaaa"
textcolor[13]="bbbbbb"
textcolor[14]="cccccc"
textcolor[15]="dddddd"
textcolor[16]="eeeeee"
textcolor[17]="ffffff"
textcolor[18]="ffffff" |
定義一個(gè)新數(shù)組,并列出其中的元素。 |
var message = new Array()
message[0]="洪恩在線 求知無限"
message[1]="十二億人的網(wǎng)上大學(xué)"
i_message=0 |
定義新數(shù)組,并列出其中的元素。 |
var i_strength=0
var i_message=0 |
聲明變量,并賦初值。 |
var timer |
聲明變量。 |
function glowtext() { |
定義函數(shù)。 |
if(document.all)
|
如果是IE瀏覽器,執(zhí)行以下語句。 |
{ if (i_strength <=17)
|
如果i_strength <=17,執(zhí)行以下語句。 |
{ glowdiv.innerText=message[i_message]
document.all.glowdiv.style.filter=
"glow(color="+textcolor[i_strength]+", strength=4)"
i_strength++
|
輸出i_message的值,然后i_strength遞加,即亮度增加。 |
timer=setTimeout("glowtext()",100) }
|
每100毫秒,調(diào)用一次glowtext函數(shù)。 |
else { clearTimeout(timer)
setTimeout("deglowtext()",1500) }
|
如果i_strength 大于17了,調(diào)用deglowtext函數(shù),即亮度開始變暗。 |
} } function deglowtext()
{ if(document.all)
{ if (i_strength >=0)
|
定義deglowtext函數(shù),并當(dāng)瀏覽器是IE時(shí),i_strength >=0時(shí),執(zhí)行以下語句。 |
{ glowdiv.innerText=message[i_message]
document.all.glowdiv.style.filter=
"glow(color="+textcolor[i_strength]+",
strength=4)"
i_strength--
|
輸出i_message的值,然后i_strength遞減,即亮度減弱。 |
timer=setTimeout("deglowtext()",100) }
else { clearTimeout(timer)
i_message++
|
每100毫秒,調(diào)用一次glowtext函數(shù),減到最暗,接著執(zhí)行下一個(gè)字符串。 |
if (i_message>=message.length)
{i_message=0} i_strength=0 intermezzo() } } }
|
如果數(shù)組message中的字符串都執(zhí)行完了,一切恢復(fù)初始設(shè)置,并執(zhí)行intermezzo函數(shù)。 |
function intermezzo()
|
定義一個(gè)函數(shù)intermezzo。 |
{ glowdiv.innerText=""
setTimeout("glowtext()",1500) } |
1.5秒后,重新調(diào)用glowtext函數(shù)。 |