JavaScript实现消息动态循环<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="placard.css">
</head>
<body>
<div class="ct_BAB" align = "center">
<div class="ct_BABA">
<div class="ct_BABAA">
<div class="ct_BABABAA"></div>
<div class="ct_BABABAB">
我的博客⽂章
</div>
</div>
<div class="ct_BABAB">
<div id="placardContent" class="ct_BABABB">
</div>
<div id="placardTemp" >
<div id="0placardItem" >
<a target="_blank" href="#">1. hibernate返回⼀个实际的类型安全java对象时遇到的错误</a><br>
</div>
<div id="1placardItem" >
<a target="_blank" href="#">2. java ⽇期处理</a><br>
</div>
<div id="2placardItem" >
<a target="_blank" href="#">3. linux挂载windows上的共享⽂件</a><br>
</div>
<div id="3placardItem" >
<a target="_blank" href="#">4. 执⾏hql参数多余错误</a><br>
</div>
<div id="4placardItem" >
<a target="_blank" href="#">5. JQUERY对页⾯属性的选择控制(整理)</a><br>
</div>
如何下载javascript
<div id="5placardItem" >
<a target="_blank" href="#">6. Lucene相关资料</a><br>
</div>
<div id="6placardItem" >
<a target="_blank" href="#">7. ⾃⼰写了个Hessian</a><br>
</div>
</div>
<script type="text/javascript">
var placartItemCount = new Number(0);//公告总数
placartItemCount = ElementById("placardTemp").getElementsByTagName("a").length;
var currentIndex = new Number(0);//当前的第⼀条公告位置
var displayCount = new Number(3);//定义公告显⽰个数
/**
* 动态滚动公告信息
**/
function placardDisplay(){
if(currentIndex == placartItemCount)
currentIndex = 0;
var str = "";
var marignCount = placartItemCount-currentIndex;
for(var i = currentIndex; i < placartItemCount; i++){
var id = i + "placardItem";
str += ElementById(id).innerHTML;
str += ElementById(id).innerHTML;
if((i - currentIndex) == (displayCount-1))
break;
}
if(marignCount < displayCount){
for(var j = 0; j < (displayCount - marignCount); j++){
id = j + "placardItem";
str += ElementById(id).innerHTML;
}
}
}
placardDisplay();
if(placartItemCount > displayCount)
setInterval(placardDisplay,3000); //每三秒执⾏⼀次
</script>
</div>
<div class="ct_BABAC"></div>
</div>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。