js实现图层区域内的文字不停向上滚动显示效果,根据自己的网站需求可以自定义文字内容及滚动速度。
<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=JavaScript> // 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 }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function b_moveIt(x,y){ 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+")") } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) //Makes the object 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()> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <DIV id=divASContainer> <DIV id=divASContent><B>曾经有一份真挚的感情摆在我面前,我没有珍惜</B> 直到失去了以后才后悔莫及。尘世间最痛苦的事没过于此。 欢迎来到武鸣人网站<B>各种信息免费发布,资源共享合作共赢!</B> </DIV> </DIV> </body>
本文来自武鸣人网站,转载请注明出处