当前位置:编程学习 > JS >>

三款文字向上滚动代码

本文章收藏了三款文字向上滚动代码他有二款是利用js实现文字向上滚动效果,一款是利用了marquee来实现文字滚动效果哦,其实有了marquee做向上滚动己就很容易了,同时还可以控制左右上下等哦。
<title>三款文字向上滚动代码</title>
<style type=text/css教程>
#divascontainer {
 clip: rect(0px 320px 120px 0px); height: 120px; left: 10px; overflow: hidden; position: absolute; top: 10px; visibility: hidden; width: 250px
}
#divascontent {
 left: 0px; position: absolute; top: 0px
}
body {
 font: 11px tahoma, arial, helvetica, sans-serif
}
div {
 font: 11px tahoma, arial, helvetica, sans-serif
}
</style>
<script language=网页特效>
// begin absolutely positioned scrollable area object scripts
function verifycompatiblebrowser(){
 this.ver=navigator.appversion
 this.dom=document.getelementbyid?1:0
 this.ie5=(this.ver.indexof("msie 5")>-1 && this.dom)?1:0;
 this.ie4=(document.all && !this.dom)?1:0;
 this.ns5=(this.dom && parseint(this.ver) >= 5) ?1:0;
 this.ns4=(document.layers && !this.dom)?1:0;
 this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
 return this
}
bw=new verifycompatiblebrowser()
lstart=120
loop=true
speed=50
pr_step=3
function constructobject(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
 this.el=bw.dom?document.getelementbyid(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
   this.css=bw.dom?document.getelementbyid(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
 this.scrollheight=bw.ns4?this.css.document.height:this.el.offsetheight
 this.newsscroll=newsscroll;
 this.moveit=b_moveit; this.x; this.y;
    this.obj = obj + "object"
    eval(this.obj + "=this")
    return this
}
 this.x=x;this.y=y
 this.css.left=this.x
 this.css.top=this.y
}
//makes the object scroll up
function newsscroll(speed){
 if(this.y>-this.scrollheight){
  this.moveit(0,this.y-pr_step)
  settimeout(this.obj+".newsscroll("+speed+")",speed)
 }else if(loop) {
  this.moveit(0,lstart)
  eval(this.obj+".newsscroll("+speed+")")
   }
}
function initialiseautoscrollarea(){
 objcontainer=new constructobject('divascontainer')
 objcontent=new constructobject('divascontent','divascontainer')
 objcontent.moveit(0,lstart)
 objcontainer.css.visibility='visible'
 objcontent.newsscroll(speed)
}
// end absolutely positioned scrollable area object scripts
</script>
<body bgcolor="#fef4d9" onload=initialiseautoscrollarea()>
文字向上滚动代码<hr>

<div id=divascontainer>
<div id=divascontent><b>文字向上滚动代码</b>
直到失去了以后才后悔莫及。www.zzzyk.com尘世间最痛苦的事没过于此。
文字向上滚动代码
<b>文字向上滚动代码</b>
</div>
</div>
</body>

代码二

<style type=text/css>
<!--
body,td,th {
    letter-spacing: 2px;
    line-height: 18px;
}
-->
</style>

<marquee onmouseo教程ver=this.stop() onmouseout=this.start() scrollamount=4 scrolldelay=90 direction=up width="100%" height=400>
<table>
<tbody>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr>
<tr>
<td>滚动文字</td></tr></tbody></table></marquee>


文字向上滚动三

<table border="1" bordercolor="#000000" bgcolor="#6699ff" cellpadding="5" cellspacing="0">
<tr>
<td>
<script language=javascript>

document.write ("<marquee scrollamount='1' scrolldelay='30' direction= 'up' width='200' id='helpor_net' height='150' onmouseover='helpor_net.stop()' onmouseout='helpor_net.start()' author:redriver; for more,visit:www.helpor.net>")

document.write ("<h2><p align='center'><font color='#ffffff' face='黑体'>偶 然</font></h2>")
document.write ("<p align='right'><a href='#' target='_blank'><font color='#ffffff'>徐志摩</font></a> ")
document.write ("<p><font color='#ffffff'> ")
document.write ("<br>我是天空里的一片云,")
document.write ("<br>偶尔投影在你的波心www.zzzyk.com—— ")
document.write ("<br>你不必讶异, ")
document.write ("<br>更无须欢喜—— ")
document.write ("<br>在转瞬间消灭了踪影。")
document.write ("<br>")
document.write ("<br>你我相逢在黑暗的海上,")
document.write ("<br>你有你的,我有我的,方向;")
document.write ("<br>你记得也好, ")
document.write ("<br>最好你忘掉, ")
document.write ("<br>在这交会时互放的光亮! ")
document.write ("</font>")

document.write ("</marquee> ")
</script>
</td>
</tr>
</table>

补充:网页制作,js教程 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,