code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset= gb2312">
<style type="text/css">
<!--
a { color: #00488C}
a:hover { color: #FF0000}
td { font-size: 12px ;color: #00488C}
-->
</style>
<script language=JAVAscript>
<!--
// ------ 定义全局变量
var theNewsNum;
var theAddNum;
var totalNum;
var CurrentPosion=0;
var theCurrentNews;
var theCurrentLength;
var theNewsText;
var theTargetLink;
var theCharacterTimeout;
var theNewsTimeout;
var theBrowserVersion;
var theWidgetOne;
var theWidgetTwo;
var theSpaceFiller;
var theLeadString;
var theNewsState;
function startTicker()
{
// ------ 设置初始数值
theCharacterTimeout = 50;//字符间隔时间
theNewsTimeout = 2000;//新闻间隔时间
theWidgetOne = "_";//新闻前面下标符1
theWidgetTwo = "-";//新闻前面下标符
theNewsState = 1;
//theNewsNum = document.body.children.incoming.children.NewsNum.innerText;//新闻总条数
//add by lin
theNewsNum = document.body.children.incoming.children.AllNews.children.length;//新闻总条数
theAddNum = document.body.children.incoming.children.AddNews.children.length;//补充条数
totalNum =theNewsNum+theAddNum;
theCurrentNews = 0;
theCurrentLength = 0;
theLeadString = " ";
theSpaceFiller = " ";
runTheTicker();
}
// --- 基础函数
function runTheTicker()
{
if(theNewsState == 1)
{
if(CurrentPosion<theNewsNum){
setupNextNews();
}
else{
setupAddNews();
}
CurrentPosion++;
if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0; //最多条数不超过5条
}
if(theCurrentLength != theNewsText.length)
{
drawNews();
}
else
{
closeOutNews();
}
}
// --- 跳转下一条新闻
function setupNextNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theNewsNum;
theNewsText = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
function setupAddNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theAddNum;
theNewsText = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
// --- 滚动新闻
function drawNews()
{
var myWidget;
if((theCurrentLength % 2) == 1)
{
myWidget = theWidgetOne;
}
else
{
myWidget = theWidgetTwo;
}
document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
theCurrentLength++;
setTimeout("runTheTicker()", theCharacterTimeout);
}
// --- 结束新闻循环
function closeOutNews()
{
document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
theNewsState = 1;
setTimeout("runTheTicker()", theNewsTimeout);
}
window.onload=startTicker;
//-->
</script>
</head>
<body>
<table>
<tr><td>
<div id=visible>CCTV 快报:<a href="" id=hottext target="_blank"></a></div>
</td></tr>
</table>
<div id=incoming style="DISPLAY: none">
<div id=AllNews>
<div id=1>
<div id=Summary>巴格达中部发生爆炸 一名美军上校被炸死</div>
<div id=NewsLink>/news/world/20031212/100145.shtml</div>
</div>
<div id=2>
<div id=Summary>科伊能源合作联合委员会举行首次会议</div>
<div id=NewsLink>/news/world/20031212/100144.shtml</div>
</div>
<div id=3>
<div id=Summary>【新闻分析】本次欧盟首脑会议难成里程碑 </div>
<div id=NewsLink>/news/world/20031212/100082.shtml</div>
</div>
<div id=4>
<div id=Summary>美国在太平洋进行海基导弹防御系统拦截试验</div>
<div id=NewsLink>/news/world/20031212/100045.shtml</div>
</div>
<div id=5>
<div id=Summary>葡萄牙缴获一艘装载有800公斤可卡因游艇</div>
<div id=NewsLink>/news/world/20031212/100043.shtml</div>
</div>
</div> <div id=AddNews>
</div>
</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset= gb2312">
<style type="text/css">
<!--
a { color: #00488C}
a:hover { color: #FF0000}
td { font-size: 12px ;color: #00488C}
-->
</style>
<script language=JAVAscript>
<!--
// ------ 定义全局变量
var theNewsNum;
var theAddNum;
var totalNum;
var CurrentPosion=0;
var theCurrentNews;
var theCurrentLength;
var theNewsText;
var theTargetLink;
var theCharacterTimeout;
var theNewsTimeout;
var theBrowserVersion;
var theWidgetOne;
var theWidgetTwo;
var theSpaceFiller;
var theLeadString;
var theNewsState;
function startTicker()
{
// ------ 设置初始数值
theCharacterTimeout = 50;//字符间隔时间
theNewsTimeout = 2000;//新闻间隔时间
theWidgetOne = "_";//新闻前面下标符1
theWidgetTwo = "-";//新闻前面下标符
theNewsState = 1;
//theNewsNum = document.body.children.incoming.children.NewsNum.innerText;//新闻总条数
//add by lin
theNewsNum = document.body.children.incoming.children.AllNews.children.length;//新闻总条数
theAddNum = document.body.children.incoming.children.AddNews.children.length;//补充条数
totalNum =theNewsNum+theAddNum;
theCurrentNews = 0;
theCurrentLength = 0;
theLeadString = " ";
theSpaceFiller = " ";
runTheTicker();
}
// --- 基础函数
function runTheTicker()
{
if(theNewsState == 1)
{
if(CurrentPosion<theNewsNum){
setupNextNews();
}
else{
setupAddNews();
}
CurrentPosion++;
if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0; //最多条数不超过5条
}
if(theCurrentLength != theNewsText.length)
{
drawNews();
}
else
{
closeOutNews();
}
}
// --- 跳转下一条新闻
function setupNextNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theNewsNum;
theNewsText = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
function setupAddNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theAddNum;
theNewsText = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
// --- 滚动新闻
function drawNews()
{
var myWidget;
if((theCurrentLength % 2) == 1)
{
myWidget = theWidgetOne;
}
else
{
myWidget = theWidgetTwo;
}
document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
theCurrentLength++;
setTimeout("runTheTicker()", theCharacterTimeout);
}
// --- 结束新闻循环
function closeOutNews()
{
document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
theNewsState = 1;
setTimeout("runTheTicker()", theNewsTimeout);
}
window.onload=startTicker;
//-->
</script>
</head>
<body>
<table>
<tr><td>
<div id=visible>CCTV 快报:<a href="" id=hottext target="_blank"></a></div>
</td></tr>
</table>
<div id=incoming style="DISPLAY: none">
<div id=AllNews>
<div id=1>
<div id=Summary>巴格达中部发生爆炸 一名美军上校被炸死</div>
<div id=NewsLink>/news/world/20031212/100145.shtml</div>
</div>
<div id=2>
<div id=Summary>科伊能源合作联合委员会举行首次会议</div>
<div id=NewsLink>/news/world/20031212/100144.shtml</div>
</div>
<div id=3>
<div id=Summary>【新闻分析】本次欧盟首脑会议难成里程碑 </div>
<div id=NewsLink>/news/world/20031212/100082.shtml</div>
</div>
<div id=4>
<div id=Summary>美国在太平洋进行海基导弹防御系统拦截试验</div>
<div id=NewsLink>/news/world/20031212/100045.shtml</div>
</div>
<div id=5>
<div id=Summary>葡萄牙缴获一艘装载有800公斤可卡因游艇</div>
<div id=NewsLink>/news/world/20031212/100043.shtml</div>
</div>
</div> <div id=AddNews>
</div>
</div>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货