320个Flash广告欣赏 200个JS广告代码 580套精选PNG素材图标 151个Flash时钟代码
225实用代码片段 30个Flash全站打包下载 55个导航菜单下载 73张精品壁纸
返回列表 回复 发帖

求高手帮忙看看这段JS为什么循环第二次的时候会出错。。。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文挡</title>
<style type="text/css">
body {text-align:center}
td {font-size: 12px;text-align:center}
</style>
</head>

<body>
<div id=makewing>
<script language=JavaScript>
marqueesHeight=60;
stopscroll=false;
with(makewing){
          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=marqueesHeight; stoptime=0;
  makewing.innerHTML+=makewing.innerHTML;
  

function init_srolltext(){
  makewing.scrollTop=0;
  setInterval("scrollUp()",1);
}init_srolltext();

function scrollUp(){
  if(stopscroll==true) return;
  currentTop+=1;
  if(currentTop==marqueesHeight+1)
  {
          stoptime+=1;
          currentTop-=1;
          if(stoptime==50)
          {
                  currentTop=0;
                  stoptime=0;                 
          }
  }
  else {         
          preTop=makewing.scrollTop;
          makewing.scrollTop+=1;
          if(preTop==makewing.scrollTop){
            makewing.scrollTop=marqueesHeight;
            makewing.scrollTop+=1;
            
          }
  }

}
init_srolltext();

</script>
        <table width="778"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="60" bgcolor="#66CCFF">1</td>
          </tr>
          <tr>
            <td height="60" bgcolor="#FFCC66">2</td>
          </tr>
          <tr>
            <td height="60" bgcolor="#99CC66">3</td>
          </tr>
          <tr>
            <td height="60" bgcolor="#66CCFF">4</td>
          </tr>
          <tr>
            <td height="60" bgcolor="#FFCC66">5</td>
          </tr>
          <tr>
            <td height="60" bgcolor="#99CC66">6</td>
          </tr>
        </table></div><br><br>
</body>
</html>
返回列表