<div style="width:543px;height:21px;overflow:hidden" onMouseOver="stop()" onMouseOut="start()"> 
<table width="543" border="0" cellspacing="0" cellpadding="0" id="scrollimg" height="21">
<tr> 
<td id="simg">
<TABLE width="543" border="0" cellspacing="0" cellpadding="0" height="21">
<tr>
            <td><a href="index.htm">不间断文字滚动</a></td>
          </tr>
</TABLE>
</td>
<td id="simg1"></td>
</tr>
</table>
</div>
<SCRIPT LANGUAGE="JavaScript">
var tm=null
function newsScroll() {
if(scrollimg.parentNode.scrollLeft!=(scrollimg.clientWidth/2))
scrollimg.parentNode.scrollLeft++;
else
scrollimg.parentNode.scrollLeft=0
}
function window.onload() {
simg1.innerHTML=simg.innerHTML
tm=setInterval('newsScroll()',20) 
}
function stop()
{
clearInterval(tm)
}function start()
{
tm=setInterval('newsScroll()',20) 
}
</SCRIPT>

解决方案 »

  1.   

    function window.onload() {
    simg1.innerHTML=simg.innerHTML
    var iIntervalID = setInterval('newsScroll()',20)
    simg1.onmouseover = function () {
    window.clearInterval(iIntervalID)
    } simg1.onmouseout = function () {
    iIntervalID = setInterval('newsScroll()',20)
    }
    }
      

  2.   

    IE FireFox兼容代码<body>
    <div style="width:543px;height:21px;overflow:hidden" onMouseOver="stop()" onMouseOut="start()"> 
    <table width="543" border="0" cellspacing="0" cellpadding="0" id="scrollimg" height="21">
    <tr> 
    <td id="simg">
    <TABLE width="543" border="0" cellspacing="0" cellpadding="0" height="21">
    <tr>
                <td><a href="index.htm">不间断文字滚动</a></td>
              </tr>
    </TABLE>
    </td>
    <td id="simg1"></td>
    </tr>
    </table>
    </div>
    <SCRIPT LANGUAGE="JavaScript">
    var tm=null
    function newsScroll() {
    if(scrollimg.parentNode.scrollLeft!=(scrollimg.clientWidth/2))
    scrollimg.parentNode.scrollLeft++;
    else
    scrollimg.parentNode.scrollLeft=0
    }
    window.onload=function() {
    simg1.innerHTML=simg.innerHTML
    tm=setInterval('newsScroll()',20) 
    }
    function stop()
    {
    clearInterval(tm)
    }function start()
    {
    tm=setInterval('newsScroll()',20) 
    }
    </SCRIPT>
    </body>
      

  3.   

    onMouseOver="stop()" onMouseOut="start()"问题是解决了
    可是为什么当显示的字数很多的时候 它就分两行显示了?不是应该是一行字的么?
      

  4.   

    onmouseover=this.stop() onmouseout=this.start()
      

  5.   

    onmouseover=this.stop() onmouseout=this.start()
    为什么要写这么复杂的代码呢?fp中不是有字幕提供的嘛?
      

  6.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>JK:支持民族工业,尽量少买X货</title>
    <script language=javascript defer> marqueeDiv1.childOffsetWidth=marqueeDiv1.children[0].offsetWidth;
    marqueeDiv1.insertAdjacentHTML("beforeEnd",marqueeDiv1.innerHTML+marqueeDiv1.innerHTML);
    window.setInterval("marqueeDiv1.scrollLeft=(marqueeDiv1.scrollLeft+marqueeDiv1.tempSpeed*1)%marqueeDiv1.childOffsetWidth;",20); marqueeDiv2.childOffsetHeight=marqueeDiv2.children[0].offsetHeight;
    marqueeDiv2.insertAdjacentHTML("beforeEnd",marqueeDiv2.innerHTML+marqueeDiv2.innerHTML);
    window.setInterval("marqueeDiv2.scrollTop=(marqueeDiv2.scrollTop+marqueeDiv2.tempSpeed*1)%marqueeDiv2.childOffsetHeight;",20);</script></head><body >
    横向连续滚动:<br>
    <div id=marqueeDiv1 nowrap style="width:800;overflow:hidden;background-color:#cccccc;" defaultSpeed=2 tempSpeed=2 onmouseOver="this.tempSpeed=0;" onmouseOut="this.tempSpeed=this.defaultSpeed;">
    <span style="width:500;">
    <font color=red >内容1</font> <font color=blue >内容2</font> <font color=black >可以通过设置span的width以决定连续之间的空白</font>
    </span>
    </div><br>
    <br>纵向连续滚动:<br>
    <div id=marqueeDiv2 nowrap style="Height:200;overflow:hidden;background-color:#cccccc;" defaultSpeed=2 tempSpeed=2 onmouseOver="this.tempSpeed=0;" onmouseOut="this.tempSpeed=this.defaultSpeed;">
    <div style="height:150px;">
    <font color=red >内容1</font><br>
    <font color=blue >内容2</font><br>
    <font color=black >可以通过设置sub div的height以决定连续之间的空白</font>
    </div>
    </div></body>
    </html>