<table style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" cellSpacing=0 cellPadding=0 width=750 align=center border=0> <tr> <td width="30"> <a href="#" onClick="clickdiv()" id="aa">向左 </a> </td> <td> <DIV id=demo style="OVERFLOW: hidden; WIDTH: 750px; COLOR: #ffffff"> <table cellSpacing=0 cellPadding=0 align=left border=0 cellspace="0"> <tr> <td id=demo1 vAlign=top> <table width="1710" height="116" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="171" background="pic_bg.jpg"> <div align="center">内容一 </div> </td> <td width="171" background="pic_bg.jpg"> <div align="center">内容二 </div> </td> <td width="171" background="pic_bg.jpg"> <div align="center">内容三 </div> </td> <td width="171" background="pic_bg.jpg"> <div align="center">内容四 </div> </td> <td width="171" background="pic_bg.jpg"> <div align="center">内容五 </div> </td> <td width="171" background="pic_bg.jpg"> <div align="center">内容六 </div> </td> </tr> </table> </td> <td id=demo2 vAlign=top> </td> </tr> </table> </DIV> </td> <td width="30"> <a href="#" onClick="Rclickdiv()" id="mcc">向右 </a> </td> </tr> </table> <SCRIPT> var speed3=25//速度数值越大速度越慢 var t=false; var id="aa"; document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML function Marquee(){ if(document.getElementById("demo2").offsetWidth-document.getElementById("demo").scrollLeft <=0) document.getElementById("demo").scrollLeft-=document.getElementById("demo1").offsetWidth else{ document.getElementById("demo").scrollLeft++ } t=false; } function RMarquee(){ if(document.getElementById("demo").scrollLeft <=0) document.getElementById("demo").scrollLeft+=document.getElementById("demo2").offsetWidth else{ document.getElementById("demo").scrollLeft-- } t=true; } function clickdiv(){ clearInterval(MyMar) Marquee(); } function Rclickdiv(){ clearInterval(MyMar) RMarquee(); } var MyMar=setInterval(Marquee,speed3) document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)} document.getElementById("demo").onmouseout=function() {if(t){MyMar=setInterval(RMarquee,speed3)}else{MyMar=setInterval(Marquee,speed3)}} document.getElementById('mcc').onmouseout=function(){clearInterval(MyMar);MyMar=setInterval(RMarquee,speed3);} document.getElementById('aa').onmouseout=function(){clearInterval(MyMar);MyMar=setInterval(Marquee,speed3);} </SCRIPT> 一个简单的向左或向右移动的案例: <base href=" <a href="http://www.it365cn.com" target="_blank">http://www.it365cn.com </a>"> <div id=demo style=overflow:hidden;height:120;width:500;background:#214984;color:#ffffff> <table align=left cellpadding=0 cellspace=0 border=0> <tr> <td id=demo1 valign=top> <a href='images/logo_1.gif'> <img src="images/logo_1.gif"> </a> <!--后面的链接自己加上--> <img src="images/logo/flashempire.gif"> <img src="images/logo.gif"> <img src="images/logo/5dmedia.gif"> <img src="images/logo/macromedia.gif"> <img src="images/logo/sucaiw.gif"> <img src="images/logo/blueieda.gif"> <img src="images/logo/htmlcn.gif"> <img src="images/logo/fwcn.gif"> </td> <td id=demo2 valign=top> </td> </tr> </table> </div> <script> //向左滚动的效果 var speed=30 demo2.innerHTML=demo1.innerHTML function Marquee(){ if(demo2.offsetWidth-demo.scrollLeft <=0) demo.scrollLeft-=demo1.offsetWidth else{ demo.scrollLeft++ } } var MyMar=setInterval(Marquee,speed) demo.onmouseover=function() {clearInterval(MyMar)} demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)} </script> <script>
- 粉丝: 1
- 资源: 6
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助