大家好,又见面了,我是你们的朋友全栈君。
以下是代码片段: <!–向左滚动代码开始–> <DIV id=rolllink style=”OVERFLOW: hidden; WIDTH: 162px; HEIGHT: 150px”><!–修改高–> <DIV id=rolllink1 style=”WIDTH: 560px; HEIGHT: 140px”><!–向上移动时,把高和宽的值相换–> <TABLE cellSpacing=5 width=”100%”> <tr> <td id=demo11 vAlign=top height=”160″><!–向上移动时修改:width=”160″–> <img src=”图片一”> <img src=”图片二”> <img src=”图片三”> <img src=”图片四”> </td> <td id=demo12 vAlign=top></td> </tr> </TABLE> </DIV> <DIV id=rolllink2></DIV> </DIV> <SCRIPT> var rollspeed=10 rolllink2.innerHTML=rolllink1.innerHTML function Marquee(){ if(rolllink2.offsetTop-rolllink.scrollLeft<=0)//向上移动时修改:if(rolllink2.offsetTop-rolllink.scrollTop<=0) rolllink.scrollLeft-=rolllink1.offsetWidth//向上移动时修改:rolllink.scrollTop-=rolllink1.offsetheight else{ rolllink.scrollLeft++//向上移动时修改:rolllink.scrollTop++ } } var MyMar=setInterval(Marquee,rollspeed) rolllink.οnmοuseοver=function() {clearInterval(MyMar)} rolllink.οnmοuseοut=function() {MyMar=setInterval(Marquee,rollspeed)} </SCRIPT> <!–滚动代码结束–>
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/161335.html原文链接:https://javaforall.cn