滚动最新消息代码

<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
  1. <style type="text/css"> 
  2. td {font-size: 12px;} 
  3. </style> 
  4. <table width="400" border="0" align="center" cellpadding="0" cellspacing="0"> 
  5. <tr> 
  6. <td width="15" valign="top"><img src="images/news.gif" alt="" width="11" height="11" /></td> 
  7. <td width="64">消息:</td> 
  8. <td width="321"><script> 
  9. var marqueeContent=new Array(); //滚动主题 
  10. marqueeContent[0]='<a href="http://www.chinaz.com/" target="_blank">+ 显而易见,最高的效率就是对现有材料的最佳利用!</a>'; 
  11. marqueeContent[1]='<a href="http://www.chinaz.com/" target="_blank">+ 显而易见,最高的效率就是对现有材料的最佳利用。</a>'; 
  12. marqueeContent[2]='<a href="http://www.chinaz.com/" target="_blank">+ 自己能解决的事,别花钱,花钱能解决的事,别求人。</a>'; 
  13. marqueeContent[3]='<a href="http://www.chinaz.com/" target="_blank">+ 旅行是需要一种心情,更重要的是,需要一种冲动。</a>'; 
  14. marqueeContent[4]='<a href="http://www.chinaz.com/" target="_blank">+ 随时用零碎的时间(如等人、排队等)做零碎的事情。</a>'; 
  15. var marqueeInterval=new Array(); //定义一些常用而且要经常用到的变量 
  16. var marqueeId=0
  17. var marqueeDelay=4000
  18. var marqueeHeight=15
  19. function initMarquee() { 
  20. var str=marqueeContent[0]; 
  21. document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(/'startMarquee()/',marqueeDelay)"><div>'+str+'</div></div>'); 
  22. marqueeId++; 
  23. marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay); 
  24. function startMarquee() { 
  25. var str=marqueeContent[marqueeId]; 
  26. marqueeId++; 
  27. if(marqueeId>=marqueeContent.length) marqueeId=0
  28. if(marqueeBox.childNodes.length==1) { 
  29. var nextLine=document.createElement('DIV'); 
  30. nextLine.innerHTML=str
  31. marqueeBox.appendChild(nextLine); 
  32. else { 
  33. marqueeBox.childNodes[0].innerHTML=str
  34. marqueeBox.appendChild(marqueeBox.childNodes[0]); 
  35. marqueeBox.scrollTop=0
  36. clearInterval(marqueeInterval[1]); 
  37. marqueeInterval[1]=setInterval("scrollMarquee()",10); 
  38. function scrollMarquee() { 
  39. marqueeBox.scrollTop++; 
  40. if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){ 
  41. clearInterval(marqueeInterval[1]); 
  42. initMarquee(); 
  43. </script></td> 
  44. </tr> 
  45. </table> 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值