javascript 怎么实现跑马灯 30
用js写的一个跑马灯<scriptlanguage="javascript">functioncls_marquee(id,id1,id2,sp){this.obj_id...
用js写的一个跑马灯
<script language="javascript">
function cls_marquee(id,id1,id2,sp){
this.obj_id=id;
this.obj_id1=id1;
this.obj_id2=id2;
this.speed=sp;
eval(this.obj_id2+".innerHTML="+this.obj_id1+".innerHTML");
function Marquee(){
if(eval(id2).offsetTop-eval(id).scrollTop<=0)
eval(id).scrollTop-=eval(id1).offsetHeight
else{
eval(id).scrollTop++
}
}
var MyMar=setInterval(Marquee,sp)
eval(this.obj_id).onmouseover=function() {clearInterval(MyMar)}
eval(this.obj_id).onmouseout=function() {MyMar=setInterval(Marquee,sp)}
}
</script>
这个怎么用啊? 展开
<script language="javascript">
function cls_marquee(id,id1,id2,sp){
this.obj_id=id;
this.obj_id1=id1;
this.obj_id2=id2;
this.speed=sp;
eval(this.obj_id2+".innerHTML="+this.obj_id1+".innerHTML");
function Marquee(){
if(eval(id2).offsetTop-eval(id).scrollTop<=0)
eval(id).scrollTop-=eval(id1).offsetHeight
else{
eval(id).scrollTop++
}
}
var MyMar=setInterval(Marquee,sp)
eval(this.obj_id).onmouseover=function() {clearInterval(MyMar)}
eval(this.obj_id).onmouseout=function() {MyMar=setInterval(Marquee,sp)}
}
</script>
这个怎么用啊? 展开
1个回答
展开全部
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html>
<script language="JavaScript1.2">
<!--
var mainwidth=190*3
var scrollerwidth=190
var scrollerheight=63
var scrollerbgcolor='e6e6e6'
var pausebetweenimages=4000
var slideimages=new Array()
slideimages[0]='<a href="http://10.65.130.240" target="_blank"><img src="../../../images/syhg/index_r_41.jpg" width="190" height="63" border="0"></a>'
slideimages[1]='<a href="<%=request.getContextPath()%>/jsp/publish/index/jsp/articleList.do?subjectOID=<bean:write name="zfgzbgOID"/>" target="_blank"><img src="../../../images/syhg/index_r_4.jpg" width="190" height="63" border="0"></a>'
slideimages[2]='<a href="http://10.65.32.240/Guestbook/" target="_blank"><img src="../../../images/syhg/index_r_5.jpg" width="190" height="63" border="0"></a>'
slideimages[3]='<a href="<%=request.getContextPath()%>/jsp/publish/index/jsp/articleList.do?subjectOID=<bean:write name="wlaqOID"/>" target="_blank"><img src="../../../images/syhg/hg_tubiao.jpg" width="190" height="63" border="0"></a>'
slideimages[4]='<a href="http://10.64.130.240" target="_blank"><img src="../../../images/syhg/index_r_31.jpg" width="190" height="63" border="0"></a>'
if (slideimages.length>4)
i=4
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.left>0&&tlayer.left<=5){
tlayer.left=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.left>=tlayer.document.width*-1){
tlayer.left-=5
setTimeout("move1(tlayer)",55)
}
else{
tlayer.left=scrollerwidth*3
tlayer.document.write(slideimages[i]+slideimages[((i>slideimages.length-2)?0:(i+1))]+slideimages[((i>slideimages.length-3)?(i+2-slideimages.length):(i+2))])
tlayer.document.close()
if(i==slideimages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.left>0&&tlayer2.left<=5){
tlayer2.left=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.left>=tlayer2.document.width*-1){
tlayer2.left-=5
setTimeout("move2(tlayer2)",55)
}
else{
tlayer2.left=scrollerwidth
tlayer2.document.write(slideimages[i]+slideimages[((i>slideimages.length-2)?0:(i+1))]+slideimages[((i>slideimages.length-3)?(i+2-slideimages.length):(i+2))])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer1(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv1.style.pixelLeft>0&&tdiv1.style.pixelLeft<=5){
tdiv1.style.pixelLeft=0
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv1.style.pixelLeft>scrollerwidth&&tdiv1.style.pixelLeft<=scrollerwidth+5){
tdiv1.style.pixelLeft=scrollerwidth
return
}
if (tdiv1.style.pixelLeft>scrollerwidth*2&&tdiv1.style.pixelLeft<=scrollerwidth*2+5){
tdiv1.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv1.style.pixelLeft>=tdiv1.offsetWidth*-1)&&(tdiv1.style.pixelLeft<=0)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv1.style.pixelLeft>=0)&&(tdiv1.style.pixelLeft<=scrollerwidth)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv1.style.pixelLeft>=scrollerwidth)&&(tdiv1.style.pixelLeft<=scrollerwidth*2)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv1.style.pixelLeft>=scrollerwidth*2)&&(tdiv1.style.pixelLeft<=scrollerwidth*3)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv1.style.pixelLeft=scrollerwidth*3
tdiv1.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer2(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv2.style.pixelLeft>0&&tdiv2.style.pixelLeft<=5){
tdiv2.style.pixelLeft=0
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv2.style.pixelLeft>scrollerwidth&&tdiv2.style.pixelLeft<=scrollerwidth+5){
tdiv2.style.pixelLeft=scrollerwidth
return
}
if (tdiv2.style.pixelLeft>scrollerwidth*2&&tdiv2.style.pixelLeft<=scrollerwidth*2+5){
tdiv2.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv2.style.pixelLeft>=tdiv2.offsetWidth*-1)&&(tdiv2.style.pixelLeft<=0)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv2.style.pixelLeft>=0)&&(tdiv2.style.pixelLeft<=scrollerwidth)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv2.style.pixelLeft>=scrollerwidth)&&(tdiv2.style.pixelLeft<=scrollerwidth*2)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv2.style.pixelLeft>=scrollerwidth*2)&&(tdiv2.style.pixelLeft<=scrollerwidth*3)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv2.style.pixelLeft=scrollerwidth*3
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer3(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv3.style.pixelLeft>0&&tdiv3.style.pixelLeft<=5){
tdiv3.style.pixelLeft=0
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv3.style.pixelLeft>scrollerwidth&&tdiv3.style.pixelLeft<=scrollerwidth+5){
tdiv3.style.pixelLeft=scrollerwidth
return
}
if (tdiv3.style.pixelLeft>scrollerwidth*2&&tdiv3.style.pixelLeft<=scrollerwidth*2+5){
tdiv3.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv3.style.pixelLeft>=tdiv3.offsetWidth*-1)&&(tdiv3.style.pixelLeft<=0)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv3.style.pixelLeft>=0)&&(tdiv3.style.pixelLeft<=scrollerwidth)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv3.style.pixelLeft>=scrollerwidth)&&(tdiv3.style.pixelLeft<=scrollerwidth*2)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv3.style.pixelLeft>=scrollerwidth*2)&&(tdiv3.style.pixelLeft<=scrollerwidth*3)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv3.style.pixelLeft=scrollerwidth*3
tdiv3.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer4(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv4.style.pixelLeft>0&&tdiv4.style.pixelLeft<=5){
tdiv4.style.pixelLeft=0
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv4.style.pixelLeft>scrollerwidth&&tdiv4.style.pixelLeft<=scrollerwidth+5){
tdiv4.style.pixelLeft=scrollerwidth
return
}
if (tdiv4.style.pixelLeft>scrollerwidth*2&&tdiv4.style.pixelLeft<=scrollerwidth*2+5){
tdiv4.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv4.style.pixelLeft>=tdiv4.offsetWidth*-1)&&(tdiv4.style.pixelLeft<=0)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv4.style.pixelLeft>=0)&&(tdiv4.style.pixelLeft<=scrollerwidth)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv4.style.pixelLeft>=scrollerwidth)&&(tdiv4.style.pixelLeft<=scrollerwidth*2)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv4.style.pixelLeft>=scrollerwidth*2)&&(tdiv4.style.pixelLeft<=scrollerwidth*3)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv4.style.pixelLeft=scrollerwidth*3
tdiv4.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (document.all){
movelayer1(first2,second2,third2,forth2)
second2.style.left=scrollerwidth
third2.style.left=scrollerwidth*2
forth2.style.left=scrollerwidth*3
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.left=scrollerwidth*3+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
//-->
</script>
<body leftmargin="0" topmargin="0">
<ilayer id="main" width="&{mainwidth};" height="&{scrollerheight};" bgcolor="&{scrollerbgcolor};">
<layer id="first" left="1" top="0" height="&{scrollerheight};">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left="&{scrollerwidth+1};" top="0" height="&{scrollerheight};" visibility="hide">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script>
</layer>
<layer id="third" left="&{scrollerwidth*2+1};" top="0" height="&{scrollerheight};" visibility="hide">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[2])
</script>
</layer>
<layer id="forth" left="0" top="0" height="&{scrollerheight};" visibility="hide">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[3])
</script>
</layer>
</ilayer>
<script
language="JavaScript1.2">
<!--
if (document.all){
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth*3+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth*3+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth*3+' '+scrollerheight+' 0);left:0;top:0">')
document.writeln('<div id="first2" style="position:absolute;height:'+scrollerheight+';left:1;top:0;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;height:'+scrollerheight+';left:'+(scrollerwidth+1)+';top:0">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('<div id="third2" style="position:absolute;height:'+scrollerheight+';left:'+(scrollerwidth*2+1)+';top:0;">')
document.write(slideimages[2])
document.writeln('</div>')
document.writeln('<div id="forth2" style="position:absolute;height:'+scrollerheight+';left:'+(scrollerwidth*3)+';top:0">')
document.write(slideimages[3])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
//-->
</script>
</body>
</html>
这个是横着东的,你改改图片的路径和链接地址就行,改了图片路径就能用了。
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html>
<script language="JavaScript1.2">
<!--
var mainwidth=190*3
var scrollerwidth=190
var scrollerheight=63
var scrollerbgcolor='e6e6e6'
var pausebetweenimages=4000
var slideimages=new Array()
slideimages[0]='<a href="http://10.65.130.240" target="_blank"><img src="../../../images/syhg/index_r_41.jpg" width="190" height="63" border="0"></a>'
slideimages[1]='<a href="<%=request.getContextPath()%>/jsp/publish/index/jsp/articleList.do?subjectOID=<bean:write name="zfgzbgOID"/>" target="_blank"><img src="../../../images/syhg/index_r_4.jpg" width="190" height="63" border="0"></a>'
slideimages[2]='<a href="http://10.65.32.240/Guestbook/" target="_blank"><img src="../../../images/syhg/index_r_5.jpg" width="190" height="63" border="0"></a>'
slideimages[3]='<a href="<%=request.getContextPath()%>/jsp/publish/index/jsp/articleList.do?subjectOID=<bean:write name="wlaqOID"/>" target="_blank"><img src="../../../images/syhg/hg_tubiao.jpg" width="190" height="63" border="0"></a>'
slideimages[4]='<a href="http://10.64.130.240" target="_blank"><img src="../../../images/syhg/index_r_31.jpg" width="190" height="63" border="0"></a>'
if (slideimages.length>4)
i=4
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.left>0&&tlayer.left<=5){
tlayer.left=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.left>=tlayer.document.width*-1){
tlayer.left-=5
setTimeout("move1(tlayer)",55)
}
else{
tlayer.left=scrollerwidth*3
tlayer.document.write(slideimages[i]+slideimages[((i>slideimages.length-2)?0:(i+1))]+slideimages[((i>slideimages.length-3)?(i+2-slideimages.length):(i+2))])
tlayer.document.close()
if(i==slideimages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.left>0&&tlayer2.left<=5){
tlayer2.left=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.left>=tlayer2.document.width*-1){
tlayer2.left-=5
setTimeout("move2(tlayer2)",55)
}
else{
tlayer2.left=scrollerwidth
tlayer2.document.write(slideimages[i]+slideimages[((i>slideimages.length-2)?0:(i+1))]+slideimages[((i>slideimages.length-3)?(i+2-slideimages.length):(i+2))])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer1(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv1.style.pixelLeft>0&&tdiv1.style.pixelLeft<=5){
tdiv1.style.pixelLeft=0
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv1.style.pixelLeft>scrollerwidth&&tdiv1.style.pixelLeft<=scrollerwidth+5){
tdiv1.style.pixelLeft=scrollerwidth
return
}
if (tdiv1.style.pixelLeft>scrollerwidth*2&&tdiv1.style.pixelLeft<=scrollerwidth*2+5){
tdiv1.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv1.style.pixelLeft>=tdiv1.offsetWidth*-1)&&(tdiv1.style.pixelLeft<=0)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv1.style.pixelLeft>=0)&&(tdiv1.style.pixelLeft<=scrollerwidth)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv1.style.pixelLeft>=scrollerwidth)&&(tdiv1.style.pixelLeft<=scrollerwidth*2)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv1.style.pixelLeft>=scrollerwidth*2)&&(tdiv1.style.pixelLeft<=scrollerwidth*3)){
tdiv1.style.pixelLeft-=5
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv1.style.pixelLeft=scrollerwidth*3
tdiv1.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer2(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv2.style.pixelLeft>0&&tdiv2.style.pixelLeft<=5){
tdiv2.style.pixelLeft=0
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv2.style.pixelLeft>scrollerwidth&&tdiv2.style.pixelLeft<=scrollerwidth+5){
tdiv2.style.pixelLeft=scrollerwidth
return
}
if (tdiv2.style.pixelLeft>scrollerwidth*2&&tdiv2.style.pixelLeft<=scrollerwidth*2+5){
tdiv2.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv2.style.pixelLeft>=tdiv2.offsetWidth*-1)&&(tdiv2.style.pixelLeft<=0)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv2.style.pixelLeft>=0)&&(tdiv2.style.pixelLeft<=scrollerwidth)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv2.style.pixelLeft>=scrollerwidth)&&(tdiv2.style.pixelLeft<=scrollerwidth*2)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv2.style.pixelLeft>=scrollerwidth*2)&&(tdiv2.style.pixelLeft<=scrollerwidth*3)){
tdiv2.style.pixelLeft-=5
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv2.style.pixelLeft=scrollerwidth*3
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer3(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv3.style.pixelLeft>0&&tdiv3.style.pixelLeft<=5){
tdiv3.style.pixelLeft=0
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv3.style.pixelLeft>scrollerwidth&&tdiv3.style.pixelLeft<=scrollerwidth+5){
tdiv3.style.pixelLeft=scrollerwidth
return
}
if (tdiv3.style.pixelLeft>scrollerwidth*2&&tdiv3.style.pixelLeft<=scrollerwidth*2+5){
tdiv3.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv3.style.pixelLeft>=tdiv3.offsetWidth*-1)&&(tdiv3.style.pixelLeft<=0)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv3.style.pixelLeft>=0)&&(tdiv3.style.pixelLeft<=scrollerwidth)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv3.style.pixelLeft>=scrollerwidth)&&(tdiv3.style.pixelLeft<=scrollerwidth*2)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv3.style.pixelLeft>=scrollerwidth*2)&&(tdiv3.style.pixelLeft<=scrollerwidth*3)){
tdiv3.style.pixelLeft-=5
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv3.style.pixelLeft=scrollerwidth*3
tdiv3.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function movelayer4(whichdiv1,whichdiv2,whichdiv3,whichdiv4){
tdiv1=eval(whichdiv1)
tdiv2=eval(whichdiv2)
tdiv3=eval(whichdiv3)
tdiv4=eval(whichdiv4)
if (tdiv4.style.pixelLeft>0&&tdiv4.style.pixelLeft<=5){
tdiv4.style.pixelLeft=0
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer1(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer2(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
setTimeout("movelayer3(tdiv1,tdiv2,tdiv3,tdiv4)",pausebetweenimages)
return
}
if (tdiv4.style.pixelLeft>scrollerwidth&&tdiv4.style.pixelLeft<=scrollerwidth+5){
tdiv4.style.pixelLeft=scrollerwidth
return
}
if (tdiv4.style.pixelLeft>scrollerwidth*2&&tdiv4.style.pixelLeft<=scrollerwidth*2+5){
tdiv4.style.pixelLeft=scrollerwidth*2
return
}
if ((tdiv4.style.pixelLeft>=tdiv4.offsetWidth*-1)&&(tdiv4.style.pixelLeft<=0)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv4.style.pixelLeft>=0)&&(tdiv4.style.pixelLeft<=scrollerwidth)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv4.style.pixelLeft>=scrollerwidth)&&(tdiv4.style.pixelLeft<=scrollerwidth*2)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else if ((tdiv4.style.pixelLeft>=scrollerwidth*2)&&(tdiv4.style.pixelLeft<=scrollerwidth*3)){
tdiv4.style.pixelLeft-=5
setTimeout("movelayer4(tdiv1,tdiv2,tdiv3,tdiv4)",55)
}
else{
tdiv4.style.pixelLeft=scrollerwidth*3
tdiv4.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (document.all){
movelayer1(first2,second2,third2,forth2)
second2.style.left=scrollerwidth
third2.style.left=scrollerwidth*2
forth2.style.left=scrollerwidth*3
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.left=scrollerwidth*3+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
//-->
</script>
<body leftmargin="0" topmargin="0">
<ilayer id="main" width="&{mainwidth};" height="&{scrollerheight};" bgcolor="&{scrollerbgcolor};">
<layer id="first" left="1" top="0" height="&{scrollerheight};">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left="&{scrollerwidth+1};" top="0" height="&{scrollerheight};" visibility="hide">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script>
</layer>
<layer id="third" left="&{scrollerwidth*2+1};" top="0" height="&{scrollerheight};" visibility="hide">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[2])
</script>
</layer>
<layer id="forth" left="0" top="0" height="&{scrollerheight};" visibility="hide">
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[3])
</script>
</layer>
</ilayer>
<script
language="JavaScript1.2">
<!--
if (document.all){
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth*3+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth*3+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth*3+' '+scrollerheight+' 0);left:0;top:0">')
document.writeln('<div id="first2" style="position:absolute;height:'+scrollerheight+';left:1;top:0;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;height:'+scrollerheight+';left:'+(scrollerwidth+1)+';top:0">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('<div id="third2" style="position:absolute;height:'+scrollerheight+';left:'+(scrollerwidth*2+1)+';top:0;">')
document.write(slideimages[2])
document.writeln('</div>')
document.writeln('<div id="forth2" style="position:absolute;height:'+scrollerheight+';left:'+(scrollerwidth*3)+';top:0">')
document.write(slideimages[3])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
//-->
</script>
</body>
</html>
这个是横着东的,你改改图片的路径和链接地址就行,改了图片路径就能用了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询