使用window.settimeout定时向下滚动
使用scroll或者scrollto函数
使用scroll或者scrollto函数
解决方案 »
- easyui中treegrid复选框不能复选的问题
- 求两正则表达式 忽忽~~!!·!~!!~·另附一?
- javascript数据库
- 如何知道一个页面已全都完成
- 如何能让一个页面先执行一段<script>代码再加载页面内容
- 一个不是很难的正则表达式!---------在线等!
- select中,如何 option 和条数定义它的高度,条数过多也不会有上下拉滚动条?
- 如何控制textarea的行数
- 将ASP嵌套在JS中在输出,怎么样才能输出换行?
- 两个页面的表单数据传送问题!!!在线等待
- 怎样获取html表格中鼠标点中的行和列的具体值???
- 请问用脚本如何来实现下面的页面跳转?请各位指教,表示感谢!!!!
<SCRIPT language=JavaScript src='http://www.colorbird.com/scroll/scroller.js'></SCRIPT>
<SCRIPT language=JavaScript src='http://www.colorbird.com/scroll/roll.js'></SCRIPT>
<BR CLEAR='all'><table width=95% border=0><tr><td><DIV id=Scroll style='HEIGHT: 18px; LEFT: 0px; POSITION: relative; TOP: 0px; WIDTH: 200px'></DIV>
//这是colorbird的滚动代码.JavaScript实现的,兼容性非常不错.
//代码也写得很不错,可以学习一下.
//你可以把以下三个js文件下载到本地.
//roll.js文件里面有程序的调用.http://www.colorbird.com/scroll/scroller.js
http://www.colorbird.com/scroll/roll.js
http://www.colorbird.com/scroll/dhtmllib.js
Ticker Tape script-
?Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
//configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted)//设置内容显示
var tickercontents=new Array()
tickercontents[0]='See what\'s New at Dynamic Drive. <a href="../../../dynamicdrive.com/new.htm">[Read more]</a>'
tickercontents[1]='Browse the most popular scripts on Dynamic Drive <a href="../../../dynamicdrive.com/hot.htm">[Read more]</a>'
tickercontents[2]='Link back to Dynamic Drive! <a href="../../../dynamicdrive.com/link.htm">[Read more]</a>'//configure the below 2 variables to set the width/background color of the ticker//设置颜色与长度
var tickerwidth='65%'
var tickerbgcolor='lightblue'//configure the below variable to determine the delay between ticking of messages (in miliseconds//设置延迟时间
var tickdelay=3000////Do not edit pass this line////////////////var currentmessage=0function changetickercontent(){
if (document.layers){
document.tickernsmain.document.tickernssub.document.write(tickercontents[currentmessage])
document.tickernsmain.document.tickernssub.document.close()
}
else if (document.all)
tickerie.innerHTML=tickercontents[currentmessage]if (currentmessage==tickercontents.length-1) currentmessage=0
else currentmessage++
setTimeout("changetickercontent()",tickdelay)
}function start_ticking(){
if (document.layers)
document.tickernsmain.visibility="show"
changetickercontent()
}if (document.all)
document.write('<div id="tickerie" style="width:'+tickerwidth+'; background-color:'+tickerbgcolor+'"></div>')
window.onload=start_ticking
</script>
<ilayer id="tickernsmain" width=&{tickerwidth}; bgColor=&{tickerbgcolor}; visibility=hide><layer id="tickernssub" width=&{tickerwidth}; left=0 top=0></layer></ilayer>
====1、将以下代码加入到HEML的<body></body>之间:<script language="JavaScript1.2">
<!--
/*设置下面的参数。 设置scrollerwidth和scrollerheight参数,设置成滚动显示的图片中尺寸最大的。*/
var scrollerwidth=140
var scrollerheight=40
var scrollerbgcolor='white'
//每个图间暂停3秒。
var pausebetweenimages=3000
//边界下面的行,如果希望logo都是带连接的,只要加上<a>标签即可。
var slideimages=new Array()
slideimages[0]='<a href="index.htm"><img src="第一张图片.gif" border=0"></a>'
slideimages[1]='<a href="index1.htm"><img src="第二张图片.gif"></a>'
slideimages[2]='<a href="index2.htm"><img src="第三张图片.gif"></a>'
slideimages[3]='<a href="index3.htm"><img src="第四张图片.gif"></a>'
//尽管填加更多的。
//////以下不要修改////////////////
if (slideimages.length>1)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",100)
}
else{
tlayer.top=scrollerheight
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",100)
}
else{
tlayer2.top=scrollerheight
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){
tdiv.style.pixelTop=0
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2)",pausebetweenimages)
return
}
if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
tdiv.style.pixelTop-=5
setTimeout("move3(tdiv)",100)
}
else{
tdiv.style.pixelTop=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){
tdiv2.style.pixelTop=0
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2)",pausebetweenimages)
return
}
if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout("move4(second2)",100)
}
else{
tdiv2.style.pixelTop=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}}
function startscroll(){
if (document.all){
move3(first2)
second2.style.top=scrollerheight
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.top=scrollerheight+5
document.main.document.second.visibility='show'
}}
window.onload=startscroll
//-->
</script> <ilayer id="main" width="&{scrollerwidth};" height="&{scrollerheight};" bgcolor="&{scrollerbgcolor};"> <layer id="first" left="0" top="1" width="&{scrollerwidth};"> <script
language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script> </layer> <layer id="second" left="0" top="0" width="&{scrollerwidth};" visibility="hide"> <script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script> </layer> </ilayer> </p>
<p><script language="JavaScript1.2">
<!--
if (document.all){
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:0">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
//--></script>
主页中间的图片滚动。
slideimages[1]='<a href="index1.htm"><img src="第二张图片.gif"></a>'
slideimages[2]='<a href="index2.htm"><img src="第三张图片.gif"></a>'
slideimages[3]='<a href="index3.htm"><img src="第四张图片.gif"></a>'这些图片如果是从数据库里提出来的,可以吗?
slideimages[1]='<a href="index1.htm"><img src="第二张图片.gif"></a>'
slideimages[2]='<a href="index2.htm"><img src="第三张图片.gif"></a>'
slideimages[3]='<a href="index3.htm"><img src="第四张图片.gif"></a>'这些图片如果是从数据库里提出来的,可以吗?