syre(神仙)所说的,会出现1的问题,一开始是好的,但是滚动几次后就会出现错误了

解决方案 »

  1.   

    这么复杂的效果,用flash好了
      

  2.   

    <script language="JavaScript">
    function Ptqyb()
    {
    //var tqyb="顺 德 天 气|少云到多云,偶有阵雨 |温度: 27~33℃ |风力:西南风,3级 |湿度:65~85%";//var strArray=tqyb.split('|');//mLen=strArray.length;
    //showId=0;//Math.floor(Math.random()*3);
    //tempStr=strArray[showId];
    //strArray[showId]=strArray[0];
    //strArray[0]=tempStr;
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0  align=center>'
    +'<tr><td width=350 align=center>'
    +'<span id="main2" style="position:relative;width:590;left:0;top:0" align=center>'
    +'<div id="toptable"  style="position:absolute;width:590;left:0;top:0" align=center>'
    +'<table width=350 border=0 cellspacing=0 cellpadding=0 align=center>');
    //for(i=0;i<mLen;i++)
    // document.write('<tr CLASS="weather" height=21><td width=30% align=center>'+strArray[i]+'</td></tr>');document.write("<P>中国奥运健儿<br>在本届奥<br>运会中,<BR>奋勇拼搏<BR>取得了骄<br>人的成绩</P><P>难道不是吗<BR>你说是不是?</P>");document.write('</table>'
    +'</div>'
    +'</span>'
    +'</td></tr>'
    +'</table>');var t=84;
    marqueesHeight=t;stopscroll=false;
    toptable.scrollTop=0;with(toptable){
      style.width=0;
      style.height=marqueesHeight;
      style.overflowX="visible";
      style.overflowY="hidden";
      noWrap=true;
      onmouseover=new Function("stopscroll=true");
      onmouseout=new Function("stopscroll=false");
    }preTop=0; currentTop=t; stoptime=0;
    toptable.innerHTML+=toptable.innerHTML;init_srolltext(t);
    }function init_srolltext(t){
      toptable.scrollTop=0;
      setInterval("scrollUp("+t+")",3);
    }function scrollUp(t){
      if(stopscroll==true) return;
      currentTop+=1;
      if(currentTop==(t+1))
      {
       stoptime+=1;
       currentTop -=1;
       if(stoptime==40) 
       {
       currentTop=0;
       stoptime=0;
       }
      }
      else {  
      preTop=toptable.scrollTop;
      toptable.scrollTop+=1;
      if(preTop==toptable.scrollTop){
        toptable.scrollTop=(t*4);
        toptable.scrollTop+=1;
      }
      }}
    </script>
    <style type="text/css">
    table{font-size:19px}
    </style>
    <table  border="1" height="85" cellpadding="0" cellspacing="0" width="80%" align="center">
    <tr><td height="85"  bgcolor="#DFF0EE" valign="top"  align="left">
    <script language="JavaScript">
    Ptqyb();
    </script>
    </td></tr>
    </table>