你可以把它看作像写一般的css列表一样,只用增加两三行代码就能完成切换效果。
#newslist{
background:#f8f8f8;border:1px solid silver;padding:1px;height:20px;line-height:20px;width:288px;
}
#contain{
font-size:12px;overflow:hidden;list-style:none;width:288px;height:20px;margin:0px;padding:0;
}
#contain li{
height:22px;line-height:22px;white-space:nowrap;overflow:hidden;
}
- csdn,中国最聚人气的it技术社区
function xx(){
var container=document.getelementbyid("contain");
container.appendchild(container.firstchild);
}
setinterval("xx()",2000);
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]