标签:
<html>
<head>
<title>逐渐显示刷新的网站公告效果</title>
<FCK:meta http-equiv="content-Type" content="text/html;charset=gb2312" />
<body>
<!--把下面代码加到<body>与</body>之间-->
网站公告:<a id="HotNews" href="" _fcksavedurl="" target="_blank"></a>
<script language="javascript">
<!--
var NewsTime = 2000;//每条新闻的停留时间
var TextTime = 50; //新闻标题文字出现等待时间,越小越快
var newsi = 0;
var txti = 0;
var txttimer;
var newstimer;
var newstitle = new Array();//新闻标题
var newshref = new Array(); //新闻链接
newstitle[0] = "巴黎接机";
newshref[0] = "http://www.balijieji.com";
newstitle[1] = "www.balijieji.com";
newshref[1] = "http://www.balijieji.com";
newstitle[2] = "巴黎导游";
newshref[2] = "http://www.balidaoyou.cn";
newstitle[3] = "www.balidaoyou.cn";
newshref[3] = "http://www.balidaoyou.cn";
function shownew()
{
var endstr = "_"
hwnewstr = newstitle[newsi];
newslink = newshref[newsi];
if(txti==(hwnewstr.length-1)){endstr="";}
if(txti>=hwnewstr.length){
clearInterval(txttimer);
clearInterval(newstimer);
newsi++;
if(newsi>=newstitle.length){
newsi = 0
}
newstimer = setInterval("shownew()",NewsTime);
txti = 0;
return;
}
clearInterval(txttimer);
document.getElementById("HotNews").href=newslink;
document.getElementById("HotNews").innerHTML = hwnewstr.substring(0,txti+1)+endstr;
txti++;
txttimer = setInterval("shownew()",TextTime);
}
shownew();
//-->
</script>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/zhaoguangxing/p/4448348.html