滚动的菜单效果

来源:互联网 发布:waterdrop mac 编辑:程序博客网 时间:2024/04/29 20:15
<script language="JavaScript1.2">
<!--
/*设置width和rheight参数*/
var width=150
var height=20
var bgcolor=''
//间暂停5秒。
var stop=5000
//定义一组文字,如果希望都是带连接的,只要加上<a>标签即可。
var images=new Array()
images[0]='<a href="www.tuqiu.com">☆这里是效果☆</a>'
images[1]='<a href="#">网上赚钱</a>'
images[2]='<a href="###">极品网址</a>'
images[3]='<a href="###">土丘学网</a>'
//你可以根据上面的格式加上更多的。
//////请不要随便改动下面的代码///////////////////////
if (images.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)",stop)
setTimeout("move2(document.main.document.second)",stop)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",100)
}
else{
tlayer.top=height
tlayer.document.write(images[i])
tlayer.document.close()
if (i==images.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)",stop)
setTimeout("move1(document.main.document.first)",stop)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",100)
}
else{
tlayer2.top=height
tlayer2.document.write(images[i])
tlayer2.document.close()
if (i==images.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)",stop)
setTimeout("move4(second2)",stop)
return
}
if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
tdiv.style.pixelTop-=5
setTimeout("move3(tdiv)",100)
}
else{
tdiv.style.pixelTop=height
tdiv.innerHTML=images[i]
if (i==images.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)",stop)
setTimeout("move3(first2)",stop)
return
}
if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout("move4(second2)",100)
}
else{
tdiv2.style.pixelTop=height
tdiv2.innerHTML=images[i]
if (i==images.length-1)
i=0
else
i++
}}
function startscroll(){
if (document.all){
move3(first2)
second2.style.top=height
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.top=height+5
document.main.document.second.visibility='show'
}}
window.onload=startscroll
//-->
</script> <ilayer id="main" width="&{width};"
height="&{height};" bgcolor="&{bgcolor};"> <layer id="first" left="0" top="1" width="&{width};"> <script
language="JavaScript1.2">
if (document.layers)
document.write(images[0])
</script> </layer> <layer id="second" left="0" top="0" width="&{width};" visibility="hide"> <script language="JavaScript1.2">
if (document.layers)
document.write(images[1])
</script> </layer> </ilayer>
<script
language="JavaScript1.2">
<!--
if (document.all){
document.writeln('<span id="main2" style="position:relative;width:'+width+';height:'+height+';overflow:hiden;background-color:'+bgcolor+'">')
document.writeln('<div style="position:absolute;width:'+width+';height:'+height+';clip:rect(0 '+width+' '+height+' 0);left:0;top:0">')
document.writeln('<div id="first2" style="position:absolute;width:'+width+';left:0;top:1;">')
document.write(images[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+width+';left:0;top:0">')
document.write(images[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
//--></script>
原创粉丝点击