|
渐显效果的文字是这样的一种动画效果:文字的颜色在浅显与深厚之间相互逐渐交换,然后不断地循环,简中还可以将文字转换。这样给人以一种若有若无的视觉效果,颇受网页制作与浏览者的喜爱。下面我们就来实现这一效果: 首先启动FrontPage2000,接着点击左下角的“HTML”标签进入HTML编辑状态。然后把HTML编辑状态下已经有的< body>代码改写成为<body bgcolor="#fef4d9" onLoad="glowtext()">。
然后在<body>与</boyd>区域之间加入下面一段代码:
| <div id="glowdiv" style="position:absolute;visibility:visible;width:600px;text-align:center; top:185px;left:70px;font-family:宋体;font-size:30pt;color:000000">< /div> |
接着再把下面一段代码加入<head>与</head>区域之中,然后点击“预览”标签即可观看到交字渐显的效果了。
<SCRIPT language="javascript"> <!-- var thissize=20 var textfont="宋体" 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"
var message = new Array() message[0]="文字渐显效果" message[1]="文字的颜色在浅显与深厚之间相互逐渐交换" message[2]="效果不断循环" i_message=0
var i_strength=0 var i_message=0 var timer
function glowtext() { if(document.all) { if (i_strength <=17) { glowdiv.innerText=message[i_message] document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)" i_strength++ timer=setTimeout("glowtext()",100) } else { clearTimeout(timer) setTimeout("deglowtext()",1500) }}}
function deglowtext() { if(document.all) { if (i_strength >=0) { glowdiv.innerText=message[i_message] document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)" i_strength-- timer=setTimeout("deglowtext()",100) } else { clearTimeout(timer) i_message++ if (i_message>=message.length) {i_message=0} i_strength=0 intermezzo() }}}
function intermezzo() { glowdiv.innerText="" setTimeout("glowtext()",1000) } //--> </SCRIPT> |
|