您的位置:首页 > 其它

文字向上滚动效果

2009-06-29 19:07 183 查看
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
//scroller width
var swidth=300

//scroller height
var sheight=100

//scroller's speed;
var sspeed=2

var wholemessage=''

//text: change to your own

wholemessage='<div align="center"><font face=Arial size=3 color="#ffffff">黄牛刺激买票人</DIV><div align="center">抚顺来的球迷老张怎么也没有想到,自己求爷爷告奶奶好不容易买到了十强赛的门票,但是在领票的时候却发现换票比求人买票还要费劲.</strong></DIV><div align="center"><strong>里面传出争吵声 </strong></DIV><div align="center">沈阳组委会这次的球票发售环节出现很多问题早已经不是新闻了</div><div align="center">编缉:飞毛腿</div></font>'

function start(){
if (document.all) return
if (document.getElementById){
document.getElementById("slider").style.visibility="show"
ns6marquee(document.getElementById('slider'))
}
else if(document.layers){
document.slider1.visibility="show"
ns4marquee(document.slider1.document.slider2)
}
}
function ns4marquee(whichlayer){
ns4layer=eval(whichlayer)
ns4layer.document.write(wholemessage)
ns4layer.document.close()
sizeup=ns4layer.document.height
ns4layer.top-=sizeup
ns4slide()
}
function ns4slide(){
if (ns4layer.top>=sizeup*(-1)){
ns4layer.top-=sspeed
setTimeout("ns4slide()",100)
}
else{
ns4layer.top=sheight
ns4slide()
}
}
function ns6marquee(whichdiv){
ns6div=eval(whichdiv)
ns6div.innerHTML=wholemessage
ns6div.style.top=sheight
sizeup=sheight
ns6slide()
}
function ns6slide(){
if (parseInt(ns6div.style.top)>=sizeup*(-1)){
ns6div.style.top=parseInt(ns6div.style.top)-sspeed
setTimeout("ns6slide()",100)
}
else{
ns6div.style.top=sheight
ns6slide()
}
}
// End -->
</script>

<span style="borderWidth:1; borderColor:red; width:300; height:100;">
<ilayer width=300 height=100 name="slider1" bgcolor="black" visibility=hide>
<layer name="slider2" onMouseover="sspeed=0;" onMouseout="sspeed=2">
</layer>
</ilayer>
<script language="JavaScript">
if (document.all){
document.writeln('<marquee id="ieslider" scrollAmount=2 width=300 height=100 direction=up style="border:1 solid red;background-color:black">')
document.writeln(wholemessage)
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=2")
document.write('</marquee>')
}
if (document.getElementById&&!document.all){
document.write('<div style="position:relative;overflow:hidden;width:300;height:100;clip:rect(0 302 102 0); background-color:black;border:1px solid red;" onMouseover="sspeed=0;" onMouseout="sspeed=2">')
document.write('<div id="slider" style="position:relative;width:&{swidth};">')
document.write('</div></div>')
}
</script></span>

第二步:请把<body>中的内容改为:
<body bgcolor="#fef4d9" onLoad='start()'>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: