Javascript Chinaz的不间断滚动新闻函数
2009-06-30 05:13:00 来源:WEB开发网<!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 type="text/CSS">
<!--
body{height:20px;line-height:20px;overflow:hidden;width:550px;margin:0 auto;font-size:14px;background:#F5FAFF;}
.sinTip {font-size:14px;}
.bbs {float:left;margin-right:10px;height:20px;line-height:20px;font-weight:bold;color:#c00;background:url(/images/news.png) no-repeat 10px 5px;padding-left:20px;}
#ullist2 {float:left;height:20px; overflow:hidden;line-height:20px;margin:0;padding:0;}
#ullist2 a{padding-left:15px;}
#ullist2 a, #ullist2 a:link, #ullist2 a:visited {color:#000;text-decoration: none;}
#ullist2 a:hover {color:#c00;}
-->
</style>
</head>
<body>
<div class="sinTip">
<div class="bbs">精彩推荐</div>
<ul id="ullist2">
<li><a href="/Bbs/Club/20090203/65103.html" target="_blank">·<font color="#0000FF">庆贺站长站7周年活动之 你发帖子我送QB</font></a></li>
<li><a href="/Bbs/Club/20090203/65089.html" target="_blank">·从春晚丫蛋看“搜狐意淫”</a><a href="/Bbs/Club/20090203/65119.html" target="_blank">·动物管理员写给华为员工的一封信</a></li>
<li><a href="/Bbs/Club/20090202/64849.html" target="_blank">·<font color="#ff0000">一道小学作业题引发的血案</font></a><a href="/Bbs/Club/20090202/65014.html" target="_blank">·网易美女多 搜狐MM姿色平平但风骚</a></li>
<li><a href="/Bbs/Club/20090202/65043.html" target="_blank">·2月2号中国站长站编辑部精彩推荐</a><a href="/Bbs/Club/20090201/64731.html" target="_blank">·英知名网站评10大鼓舞人心IT事件</a></li>
<li><a href="/Bbs/Club/20090201/64729.html" target="_blank">·英女皇亲自参与革新英皇室官网</a><a href="/Bbs/Club/20090202/64928.html" target="_blank">·<font color="#008040">新浪UC现免费色情聊天室 表演露骨</font></a></li>
<li><a href="/Bbs/Club/20090201/64727.html" target="_blank">·Google官方解释昨日全球搜索报错事件</a><a href="/Bbs/Club/20090201/64724.html" target="_blank">· 站长站首发 牛年站长赚钱秘籍</a></li>
<li><a href="/Bbs/Club/20090202/64933.html" target="_blank">·<font color="#336633">恒源祥最新雷人广告 被指低级炒作</font></a><a href="/Bbs/Club/20090201/64718.html" target="_blank">·微软 Windows 7时代64位版将成主流</a></li>
<li><a href="/Bbs/Club/20090201/64715.html" target="_blank">·阿里巴巴加薪的本质是企业困境</a><a href="/Bbs/Club/20090201/64708.html" target="_blank">·系统管理员阴谋删除房利美服务器数据而被捕</a></li>
<li><a href="/Bbs/Club/20090201/64704.html" target="_blank">·美女赵飞燕有致命女人香</a> <a href="/Bbs/Club/20090201/64703.html" target="_blank">·监测公告 发现大量计算机遭恶意木马入侵</a></li>
<li><a href="/Bbs/Club/20090201/64700.html" target="_blank">·网友贴择偶条件细则 可以随时付出生命</a><a href="/Bbs/Club/20090201/64698.html" target="_blank">·网店销售假名牌运动服饰 4名青年被抓</a></li>
<li><a href="/Bbs/Club/20090201/64691.html" target="_blank">·百度上春晚 实现品牌建设新跨越</a><a href="/Club/20090202/64922.html" target="_blank">·网友曝光 3G运营推广或觊觎鸟巢冠名</a></li>
</ul>
</div> http://www.cncms.com
<script type="text/javascript">
(function(ul, delay, speed, lineHeight) {
var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
var delay = delay||1000;
var speed=speed||20;
var lineHeight = lineHeight||20;
var tid = null, pause = false;
var start = function() {
tid=setInterval(slide, speed);
}
var slide = function() {
if (pause) return;
slideBox.scrollTop += 2;
if ( slideBox.scrollTop % lineHeight == 0 ) {
clearInterval(tid);
slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
slideBox.scrollTop = 0;
setTimeout(start, delay);
}
}
slideBox.onmouSEOver=function(){pause=true;}
slideBox.onmouseout=function(){pause=false;}
setTimeout(start, delay);
})
( 'ullist2', 3000, 1, 20 );//停留时间,相对速度(越小越快),每次滚动多少,最好和Li的Line-height一致。
</script>
</body>
</html>
Tags:Javascript Chinaz 间断
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接