js循环滚动新闻,最简洁版

<script type="text/javascript">    
//滚动信息
window.onload=function(){marquee('roll_box','roll_content','roll_temp','40'); }
function marquee(id,id1,id2,speed){	
	var obj=document.getElementById(id);
	var obj1=document.getElementById(id1);
	var obj2=document.getElementById(id2);
	obj2.innerHTML=obj1.innerHTML;
	function scrolly(){if(obj.scrollTop>=obj1.offsetHeight){obj.scrollTop=0;}else{obj.scrollTop++;}}
	var rollTime=setInterval(scrolly,speed);
	obj.onmouseover=function(){clearInterval(rollTime);}
	obj.onmouseout=function(){rollTime=setInterval(scrolly,speed);}
} 
</script>


<div id="roll_box" style="height:200px;overflow:hidden;"><div id="roll_content">
	
	<!--滚动内容start-->
	<li><a href="/index.php/news/show/id/10782" target="_blank">福格森®孕妇维D3钙片成功获得国食健...</a><span></span></li>
	<li><a href="/index.php/news/show/id/10781" target="_blank">我公司喜获湖北省著名商标</a><span></span></li>
	<li><a href="/index.php/news/show/id/10780" target="_blank">喜讯:我公司已被评为“2010年度湖...</a><span></span></li>
	<li><a href="/index.php/news/show/id/10779" target="_blank">我公司参加华人华创创业发展洽谈会展会...</a></li>
	<li><a href="/index.php/news/show/id/10775" target="_blank">出生缺陷诊断防治进展高级培训班在郑州...</a></li>
	<li><a href="/index.php/news/show/id/10774" target="_blank">敬告各位朋友:福格森免费400882...</a></li>
	<li><a href="/index.php/news/show/id/10743" target="_blank">“福格森”爱心奉献滕州市病残儿家庭</a></li>
	<li><a href="/index.php/news/show/id/10742" target="_blank">福格森热烈祝贺湖北省计划生育服务交流...</a></li>
	<li><a href="/index.php/news/show/id/10740" target="_blank">预防出生缺陷 全社会的责任-----...</a></li>
	<li><a href="/index.php/news/show/id/10737" target="_blank">济南日报:历城筑牢三道防线拦截出生缺...</a></li>  
	<!--滚动内容end-->                      
	
</div><div id="roll_temp"></div>
</div>

 

你可能感兴趣的:(js)