首页 > 代码库 > 文字向上滚动代码,带段落停顿
文字向上滚动代码,带段落停顿
- 带段落停顿效果的文字向上滚动代码,一个比较早的代码了,但觉得现在仍很常用,它可以定义文字成批次(段落)向上滚动,滚动后停顿,然后继续滚动,很不错啦,希望大家也喜欢。
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>接触角测定仪</title></head><body bgcolor="#ffffff" onl oad="startVTextScroll()"> <script language="JavaScript"><!--var scrollerwidth=162var scrollerheight=130var pausebetweenimages=5000var vSlideContent=new Array()vSlideContent[0]=‘<p>1.Vertical Scrolling Layers</p><p>By David Miles<br></p><p>Damn, this is snazzy.</p>‘vSlideContent[1]=‘<p>2.It sure is a good thing you decided to add more shock to your site, We have the highest quality DHTML and JavaScripts around.</p><p>(Please pardon our advertising propaganda.)</p>‘vSlideContent[2]=‘<p>3. Lorem ipsum dolor sit amet, consectetur adipscing elit, sed diam nonnumy eiusmod tempor incidunt ut labore et dolore magna aliquam erat volupat.</p><p>Et harumd dereud facilis est er expedit distinct. Nam liber a tempor cum soluta nobis eligend optio comque nihil quod a impedit anim id quod maxim placeat facer possim omnis es voluptas assumenda est, omnis dolor repellend. Temporem autem quinsud et aur office debit aut tum rerum necesit atib saepe eveniet ut er repudiand sint et molestia non este recusand.</p>‘vSlideContent[3]=‘4. still more text ...‘if (vSlideContent.length>1)i=2elsei=0function locateObject(n, d) { //v3.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p); } if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document); return x;}function moveVTextFirstBlock(whichdiv){if (document.all){ tdiv=eval(whichdiv) if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5) { tdiv.style.pixelTop=0 setTimeout("moveVTextFirstBlock(tdiv)",pausebetweenimages) setTimeout("moveVTextSecondBlock(‘vTextSecond‘)",pausebetweenimages) return } if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1) { tdiv.style.pixelTop-=5 setTimeout("moveVTextFirstBlock(tdiv)",10) } else{ tdiv.style.pixelTop=scrollerheight+5window.status=tdiv.style.pixelTop; tdiv.innerHTML=vSlideContent[i] if (i==vSlideContent.length-1) i=0else i++}}else{tlayer=eval(whichdiv)if (tlayer.top>0&&tlayer.top<=5){tlayer.top=0setTimeout("moveVTextFirstBlock(tlayer)",pausebetweenimages)setTimeout("moveVTextSecondBlock(locateObject(‘vTextSecond‘))",pausebetweenimages)return}if (tlayer.top>=tlayer.document.height*-1){tlayer.top-=5setTimeout("moveVTextFirstBlock(tlayer)",10)}else{tlayer.top=scrollerheight+5tlayer.document.write(vSlideContent[i])tlayer.document.close()if (i==vSlideContent.length-1)i=0elsei++}}}function moveVTextSecondBlock(whichdiv){if (document.all){tdiv2=eval(whichdiv)if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){ tdiv2.style.pixelTop=0 setTimeout("moveVTextSecondBlock(tdiv2)",pausebetweenimages) setTimeout("moveVTextFirstBlock(‘vTextFirst‘)",pausebetweenimages) return}window.status=tdiv2.offsetHeight;if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){ tdiv2.style.pixelTop-=5 setTimeout("moveVTextSecondBlock(‘vTextSecond‘)",10)}else{ tdiv2.style.pixelTop=scrollerheight+5window.status=tdiv2.style.pixelTop tdiv2.innerHTML=vSlideContent[i] if (i==vSlideContent.length-1) i=0else i++}}else if (document.layers){tlayer2=eval(whichdiv)if (tlayer2.top>0&&tlayer2.top<=5){tlayer2.top=0setTimeout("moveVTextSecondBlock(tlayer2)",pausebetweenimages)setTimeout("moveVTextFirstBlock(locateObject(‘vTextMain‘).document.layers[‘vTextFirst‘])",pausebetweenimages)return}if (tlayer2.top>=tlayer2.document.height*-1){tlayer2.top-=5setTimeout("moveVTextSecondBlock(tlayer2)",10)}else{tlayer2.top=scrollerheight+5tlayer2.document.write(vSlideContent[i])tlayer2.document.close()if (i==vSlideContent.length-1)i=0elsei++}}}function startVTextScroll(){if (document.all){ locateObject(‘vTextSecond‘).style.top=scrollerheight+5 locateObject(‘vTextFirst‘).visibility=‘visible‘; locateObject(‘vTextSecond‘).visibility=‘visible‘; moveVTextFirstBlock(locateObject("vTextFirst"))}else if (document.layers){ locateObject(‘vTextMain‘).visibility=‘show‘ locateObject(‘vTextFirst‘).visibility=‘show‘ locateObject(‘vTextSecond‘).top=scrollerheight+5 locateObject(‘vTextSecond‘).visibility=‘show‘ moveVTextFirstBlock(locateObject(‘vTextMain‘).document.layers[‘vTextFirst‘])}}//--></script><style type="text/css"><!--div { font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: #000000}--></style><div id="vTextMain" style="width:162; height:130; position:absolute; top: 5; left: 5; visibility: visible; clip: rect(0 162 130 0); overflow: hidden; z-index: 2"> <div id="vTextFirst" style="top:1; width:162;position:absolute; z-index: 1; padding: 1px 1px; visibility: visible; overflow: hidden; clip: rect(0 162 132 0)"> <script language="JavaScript">document.write(vSlideContent[0])</script></div><div id="vTextSecond" style="top:1; width:162;position:absolute; z-index: 0; padding: 1px 1px; visibility: visible; overflow: hidden; clip: rect(0 162 132 0)"> <script language="JavaScript">document.write(vSlideContent[1])</script></div> </div></body></html>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。