"; }else{ html += ""; } $("#leftContent").html(html); if(beginId<=8&&endId>=8){ loadNineData(); } } //加载第一页数据 function addFirstData(){ $("#open_box").remove(); var html = $("#leftContent").html(); var beginId = current; var endId = beginId+firstSize; current = endId; if(endId > dataArray.length){ flag = true; endId = dataArray.length; } for(var i=beginId;i没有更多数据
"; }else{ html += ""; } $("#leftContent").html(html); if(beginId<=8&&endId>=8){ loadNineData(); } } //获取数据 function getData(){ $.getJSON(url,function(data){ dataArray = data.rollData; addFirstData(); }) } //数据装载页面 function loadHtml(obj){ var tagArray = obj.content.split(" "); var html = "
"; if(obj.type=="ARTI"){ //正文有两条相关 if(obj.relatedNews1!=""&&obj.relatedNews2!=""){ html += "

"+obj.title+"

"; html += "
"; html += "

"+obj.description+"

"; html += "
"; html += ""; html += "
"; //如果维护了编目并且维护了简介 }else if(obj.catalog!=""&&obj.brief.indexOf("http")>-1){ var imageUrlArray = obj.brief.split("|"); html += "

"+obj.title+"

"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; //如果维护了编目没有维护简介 }else if(obj.catalog!=""&&obj.brief.indexOf("http")>-1){ html += "

"+obj.title+" 专题

"; html += "
"; if(obj.image!=""){ html += "
"; } html += "

"+obj.description+"

"; //如果没维护编目维护了简介 }else if(obj.catalog==""&&obj.brief.indexOf("http")>-1){ var imageUrlArray = obj.brief.split("|"); html += "

"+obj.title+"

"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; }else if(obj.image!=""){ html += "

"+obj.title+"

"; html += "
"; html += "
"; html += "

"+obj.description+"

"; }else{ html += "

"+obj.title+"

"; html += "
"; html += "

"+obj.description+"

"; } }else if(obj.type=="PHOA"){ html += "

"+obj.title+"

"; html += "
"; if(obj.image!=""){ html += "
"; } }else if(obj.type=="VIDE"){ html += "

"+obj.title+"

"; html += "
"; html += "
"; html += "

"+obj.description+"

"; } html += "

"; for(var i=0;i"+tagArray[i]+" "; } html += "

"; html += "
"+obj.dateTime+"
"; html += "
"; return html; } //获取新数据 function getNewData(){ $.getJSON(url+"?r="+Math.random(),function(data){ var newDataArray = data.rollData; var distance = 0; if(dataArray!=null&&dataArray[0].title!=""){ for(var i=0;i更新0条新闻,点击刷新 "; $(".moption").html(topHtml); dataArray = newDataArray; }) } //获取新数据的条数 function getNewDataNum(){ $.getJSON(url+"?r="+Math.random(),function(data){ var newDataArray = data.rollData; var distance = 0; if(dataArray!=null&&dataArray[0].title!=""){ for(var i=0;i更新"+distance+"条新闻,点击刷新 "; $(".moption").html(topHtml); }) } getData(); window.setInterval("getNewDataNum()",120000); function jsonpcallback(data){ var myNineTime = '各网头条汇'+ data['date']+''; var myNineHtml = ""; var myNine = data['news_list']; for(var i=0;i"+myNine[i].source+":"+myNine[i].title+""; } $("#myNineTime").html(myNineTime); $("#myThreeTime").html(data['date']); $("#myNine").html(myNineHtml); } function loadNineData(){ function loadjquery(m){ var d=document.createElement("script"); d.setAttribute("charset","utf-8"); d.type="text/javascript"; d.language="javascript"; d.src=m; document.getElementsByTagName("body")[0].appendChild(d); if(d.readyState){ d.onreadystatechange=function(){ if(!this.readyState||this.readyState=="loaded"||this.readyState=="complete"){ //外部js加载完成 delete d; } } }else{ d.onload=function(){ delete d; } } } var nineUrl="//news.cntv.cn/xinwentoutiao/topten/EconomicHeadlines.js"; loadjquery(nineUrl); }