连续滚动的广告代码

来源:互联网 发布:js模拟点击a标签 编辑:程序博客网 时间:2024/05/12 19:16
<DIV   id=marquees>   
                                                  <table   width="100"   border="1">   
                                                      <tr>   
                                                          <td>是时候给分了兄弟</td>   
                                                      </tr>   
                                                  </table>   
                                              </DIV>   
                                      <SCRIPT>   
    
  marqueesHeight=870;   
  stopscroll=false;   
  with(marquees){   
  noWrap=true;   
  style.width=0;   
  style.height=marqueesHeight;   
  style.overflowY="hidden";   
    
  onmouseover=new   Function("stopscroll=true");   
  onmouseout=new   Function("stopscroll=false");   
  }   
  document.write('<div   id="templayer"   style="position:absolute;z-index:1;visibility:hidden"></div>');   
    
  function   init(){   
  while(templayer.offsetHeight<marqueesHeight){   
  templayer.innerHTML+=marquees.innerHTML;   
  }   
  marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;   
  setInterval("scrollUp()",10);   
  }   
  document.body.onload=init;   
    
  preTop=0;   
    
  function   scrollUp(){   
  if(stopscroll==true)   return;   
  preTop=marquees.scrollTop;   
  marquees.scrollTop+=1;   
    
  if(preTop==marquees.scrollTop){   
  marquees.scrollTop=templayer.offsetHeight-marqueesHeight+1;   
  }   
  }   
  -->   
  </SCRIPT>