希望对你有帮助- <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
- <head>
- <title>滚动</title>
- </head>
- <body>
- <table width="700">
- <tr>
- <td>
- <div id="img" style="overflow:hidden;height:120px;width:700px;">
- <table align="left" >
- <tr>
- <td id="img1" valign="top">
- <table >
- <tr>
- <td>
- <img src="" width="150" hspace=22>
- </td>
- <td>
- <img src="" width="150" hspace=22>
- </td>
- <td>
- <img src="" width="150" hspace=22>
- </td>
- <td>
- <img src="" width="150" hspace=22>
- </td>
- <td>
- <img src="" width="150" hspace=22>
- </td>
- </tr>
- </table>
- </td>
- <td id="img2" valign="top">
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- <script type="text/javascript">
- var speed=10//速度数值越大速度越慢
- img2.innerHTML=img1.innerHTML
- function Marquee(){
- if(img2.offsetWidth-img.scrollLeft<=0){
- img.scrollLeft-=img1.offsetWidth
- }
- else{
- img.scrollLeft++
- }
- }
-
-
- var MyMar=setInterval(Marquee,speed)
-
-
- img.onmouseover=function() {
- clearInterval(MyMar)
- }
-
-
- img.onmouseout=function() {
- MyMar=setInterval(Marquee,speed)
- }
- </script>
- </body>
- </html>
复制代码 |