61,115
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
#margee01 {height:100px; overflow:hidden;}
</style>
</head>
<body>
<div class="box">
<div id="margee01" onMouseOver="iScrollAmount=0" onmouseout="iScrollAmount=1">
<ul>
<li>滚动新闻 </li>
<li>滚动新闻 </li>
<li>滚动新闻 </li>
<li>滚动新闻1 </li>
<li>滚动新闻1 </li>
<li>滚动新闻1 </li>
<li>滚动新闻1 </li>
<li>滚动新闻1</li>
<li>滚动新闻1 </li>
<li>滚动新闻1</li>
<li>滚动新闻1 </li>
<li>滚动新闻1 </li>
</ul>
</div>
</div>
<script type="text/javascript">
var oMarquee = document.getElementById("margee01"); //滚动对象
var iLineHeight = 24; //单行高度,像素
var iLineCount = 12; //实际行数
var iScrollAmount = 1; //每次滚动高度,像素
function run() {
oMarquee.scrollTop += iScrollAmount;
if ( oMarquee.scrollTop == iLineCount * iLineHeight )
oMarquee.scrollTop = 0;
if ( oMarquee.scrollTop % iLineHeight == 0 ) {
window.setTimeout( "run()", 1000 );
} else {
window.setTimeout( "run()", 100 );
}
//alert("AAAAAA:"+oMarquee.scrollTop);
}
oMarquee.innerHTML += oMarquee.innerHTML;
window.setTimeout( "run()", 2000 );
</script>
</body>
</html>