<script language="javascript">
var news_scroll_bar = document.getElementById("scrollDiv");
var news_scroll_items = document.getElementById("news_scroll_items");
var news_scroll_replaces = document.getElementById("news_scroll_replaces");
var speed = 30; //滚动速度
var mtop = news_scroll_bar.currentStyle.marginTop; //初始高度
news_scroll_replaces.innerHTML = news_scroll_items.innerHTML
function Marquees() {
if (news_scroll_replaces.offsetTop - news_scroll_bar.scrollTop <= 0)
news_scroll_bar.scrollTop -= news_scroll_items.offsetHeight + mtop
else {
news_scroll_bar.scrollTop++
}
}
var MyMars = setInterval(Marquees, speed)
news_scroll_bar.onmouseover = function() { clearInterval(MyMars) }
news_scroll_bar.onmouseout = function() { MyMars = setInterval(Marquees, speed) }
</script>
html:
<div id="scrollDiv" >
<div id="news_scroll_items" >
<p>
2009-1-24
龙途总经理室/Admin
销售通告信息111</p>
<p>
2010-10-1
龙途呼叫中心/王承德
销售编辑</p>
<p>
2010-9-15
部门不存在或已删除/无
asdfasdfasdfasdfasdfasdf</p>
<p>
2009-1-24
龙途总经理室/Admin
销售通告信息</p>
<p>
2010-10-1
龙途呼叫中心/王承德
销售编辑</p>
</div>
<div id="news_scroll_replaces" > </div>
</div>