文字左右滚动的走马灯效果是一种非常容易实现的特效同样的文字上下滚动循环显示也是一种非常常见而且非常容易实现的文字特效
具体实现方法如下
<script language=javascript>
var messages=new Array()
messages[]=<font color=#FF>欢迎光临赛迪网电脑应用频道!</font></a>
messages[]=<font color=#FB>这里有织网梦工厂</font></a>
messages[]=<font color=#FFF>是网页初学者的学习园地</font></a>
messages[]=<font color=#FF>这里沖浪指南针</font></a>
messages[]=<font color=#CC>是网络爱好者天天必来充电的地方</font></a>
messages[]=<font color=#>这里有…………有精彩的内容等着你</font></a>
var scrollerwidth=
var scrollerheight=
var scrollerbgcolor=#FFFFFF
//下面的代码不要改动
if (messageslength>)
i=
else
i=
function move(whichlayer){
tlayer=eval(whichlayer)
if (tlayertop>&&tlayertop<=){
tlayertop=
setTimeout(move(tlayer))
setTimeout(move(documentmaindocumentsecond))
return}
if (tlayertop>=tlayerdocumentheight*){
tlayertop=
setTimeout(move(tlayer))}
else{
tlayertop=scrollerheight
tlayerdocumentwrite(messages[i])
tlayerdocumentclose()
if (i==messageslength)
i=
else
i++}}
function move(whichlayer){
tlayer=eval(whichlayer)
if (tlayertop>&&tlayertop<=){
tlayertop=
setTimeout(move(tlayer))
setTimeout(move(documentmaindocumentfirst))
return}
if (tlayertop>=tlayerdocumentheight*){
tlayertop=
setTimeout(move(tlayer))}
else{
tlayertop=scrollerheight
tlayerdocumentwrite(messages[i])
tlayerdocumentclose()
if (i==messageslength)
i=
else
i++}}
function move(whichdiv){
tdiv=eval(whichdiv)
if (tdivstylepixelTop>&&tdivstylepixelTop<=){
tdivstylepixelTop=
setTimeout(move(tdiv))
setTimeout(move(second))
return}
if (tdivstylepixelTop>=tdivoffsetHeight*){
tdivstylepixelTop=
setTimeout(move(tdiv))}
else{
tdivstylepixelTop=scrollerheight
tdivinnerHTML=messages[i]
if (i==messageslength)
i=
else
i++}}
function move(whichdiv){
tdiv=eval(whichdiv)
if (tdivstylepixelTop>&&tdivstylepixelTop<=){
tdivstylepixelTop=
setTimeout(move(tdiv))
setTimeout(move(first))
return}
if (tdivstylepixelTop>=tdivoffsetHeight*){
tdivstylepixelTop=
setTimeout(move(second))}
else{
tdivstylepixelTop=scrollerheight
tdivinnerHTML=messages[i]
if (i==messageslength)
i=
else
i++}}
function startscroll(){
if (documentall){
move(first)
secondstyletop=scrollerheight}
else if (documentlayers){
move(documentmaindocumentfirst)
documentmaindocumentsecondtop=scrollerheight+
documentmaindocumentsecondvisibility=show}}
windowonload=startscroll
</script>
<ilayer id=main width=&{scrollerwidth}; height=&{scrollerheight};
bgcolor=&{scrollerbgcolor};>
<layer id=first left= top= width=&{scrollerwidth};>
<script language=javascript>
if (documentlayers)
documentwrite(messages[])
</script>
</layer>
<layer id=second left= top= width=&{scrollerwidth}; visibility=hide>
<script language=javascript>
if (documentlayers)
documentwrite(messages[])
</script>
</layer>
</ilayer>
<script language=javascript>
if (documentall){
documentwriteln(<span id=main >)
documentwriteln(<div >)
documentwriteln(<div id=first >)
documentwrite(messages[])
documentwriteln(</div>)
documentwriteln(<div id=second >)
documentwrite(messages[])
documentwriteln(</div>)
documentwriteln(</div>)
documentwriteln(</span>)
}
</script>
(在需要添加该特效的网页具体位置中粘贴如下代码即可)
注意代码中的var scrollerwidth=表示循环框宽度var scrollerheigh=表示循环框高度font color=# 代表文字颜色可以根据需要进行修改