代码:【复制】<style> td { font-size:12px; } </style> <table width="400" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="65">滚动消息:</td> <td width="335"> <script language="JavaScript"> <!-- var marqueeContent=new Array(); //滚动主题 marqueeContent[0]='<a href="http://www.goalercn.com/" target="_blank">+ 显而易见,最高的效率就是对现有材料的最佳利用!</a>'; marqueeContent[1]='<a href="http://www.goalercn.com/" target="_blank">+ 显而易见,最高的效率就是对现有材料的最佳利用。</a>'; marqueeContent[2]='<a href="http://www.goalercn.com/" target="_blank">+ 自己能解决的事,别花钱,花钱能解决的事,别求人。</a>'; marqueeContent[3]='<a href="http://www.goalercn.com/" target="_blank">+ 旅行是需要一种心情,更重要的是,需要一种冲动。</a>'; marqueeContent[4]='<a href="http://www.goalercn.com/" target="_blank">+ 随时用零碎的时间(如等人、排队等)做零碎的事情。</a>'; var marqueeInterval=new Array(); //定义一些常用而且要经常用到的变量 var marqueeId=0; var marqueeDelay=4000; var marqueeHeight=15; function initMarquee() { var str=marqueeContent[0]; 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>'); marqueeId++; marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay); } function startMarquee() { var str=marqueeContent[marqueeId]; marqueeId++; if(marqueeId>=marqueeContent.length) marqueeId=0; if(marqueeBox.childNodes.length==1) { var nextLine=document.createElement('DIV'); nextLine.innerHTML=str; marqueeBox.appendChild(nextLine); } else { marqueeBox.childNodes[0].innerHTML=str; marqueeBox.appendChild(marqueeBox.childNodes[0]); marqueeBox.scrollTop=0; } clearInterval(marqueeInterval[1]); marqueeInterval[1]=setInterval("scrollMarquee()",10); } function scrollMarquee() { marqueeBox.scrollTop++; if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){ clearInterval(marqueeInterval[1]); } } initMarquee(); //--> </script> </td> </tr> </table>