Html页面分页算法和后台与数据库的交互

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Html页面分页算法和后台与数据库的交互
var pageTotal=1;
var lastPage="a1";
var infoType="";
var infoTypeList=null;
var timesNum=10; //每页显示的条数
indexAction.getInfoMaster(loginUserMap,{
async : false,
callback : function(data){
if(data!=null&&data.length!=0){
var html="";
pageTotal=data[0].pageTotal;
if(pageTotal<7){
if(pageTotal!=1){
html="<a id='a1'
style='cursor:pointer;color:blue;'
onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&
nbsp;";
for(var i=2;i<pageTotal;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+i+"</a>&nbsp;&nb
sp;&nbsp;";
}
html+="<a id='a"+pageTotal+"'
style='cursor:pointer;'
onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp
;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"'
style='cursor:pointer;' onclick='pageClick(this)'>
下一页</a>";
}else{
html="";
}
document.getElementById("page").innerHTML=html;
}else{
html="<a id='a1' style='cursor:pointer;color:blue;'
onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;";
for(var i=2;i<5;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+i+"</a>&nbsp;&nbsp;&
nbsp;";
}
html+="<a id='a5' style='cursor:pointer;'
onclick='pageClick(this)'>5</a>...";
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nb
sp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"'
style='cursor:pointer;' onclick='pageClick(this)'>下
一页</a>";
document.getElementById("page").innerHTML=html;
}
for(var i=0;i<data.length;i++)
{
html="";
if(data[i].THUMBNAIL_URL1!=null&&data[i].THUMBNA IL_URL1!=""&&data[i].THUMBNAIL_URL1!="null")
{
html="<img
src='<%=basePath%>"+data[i].THUMBNAIL_URL1+"'
width='176' height='99' />";
}else{
html="<img src='<%=basePath%>/images/noImage.jpg'
width='176' height='99'' />";
}
document.getElementById("b"+i).innerHTML=html;
html="";
html="<a id='c"+data[i].INFO_PUBLISH_ID+"'
name='d"+data[i].INFO_MASTER_ID+"'
href='javascript:void(0)'
onclick='infoChecked(this)'><div
class='title'>"+data[i].INFO_NAME+"</div></a>";
document.getElementById("b"+i+"0").innerHTML=html;
html="";
if(data[i].INFO_CONTENT!=null&&data[i].INFO_CONTENT!
=""&&data[i].INFO_CONTENT!="")
{
html=stringChange(data[i].INFO_CONTENT,70);
}
document.getElementById("b"+i+"1").innerHTML=html;
html="";
if(data[i].ORG_NAME!=null&&data[i].ORG_NAME!=undefin
ed&&data[i].ORG_NAME!=""&&data[i].ORG_NAME!="null") if(data[i].ORG_NAME.length<9)
html=data[i].ORG_NAME+"&nbsp;&nbsp;&nbsp;";
else
html=data[i].ORG_NAME.substring(0,8)+"...&nbsp;&nbsp;&nbsp;";
html+=data[i].PUBLISH_TIME.substring(0,10);
if(data[i].INFO_TYPE_S_NAME!=null&&data[i].INFO_TYPE
_S_NAME!=""&&data[i].INFO_TYPE_S_NAME!="null")
html+="&nbsp;&nbsp;&nbsp;"+data[i].INFO_TYPE_S_NAME;
document.getElementById("b"+i+"2").innerHTML=html;
html="";
if(data[i].COMMENT_TIMES==undefined||data[i].COMMENT
_TIMES==""||data[i].COMMENT_TIMES==null||data[i].COM
MENT_TIMES=="null")
data[i].COMMENT_TIMES="0";
if(data[i].SUPPORT_TIMES==undefined||data[i].SUPPORT
_TIMES==""||data[i].SUPPORT_TIMES==null||data[i].SUP
PORT_TIMES=="null")
data[i].SUPPORT_TIMES="0";
if(data[i].CLICK_TIMES==undefined||data[i].CLICK_TIM
ES==""||data[i].CLICK_TIMES==null||data[i].CLICK_TIM
ES=="null")
data[i].CLICK_TIMES="0";
html+="评价:"+data[i].COMMENT_TIMES+"&nbsp;点
赞:"+data[i].SUPPORT_TIMES+"&nbsp;浏
览:"+data[i].CLICK_TIMES;
document.getElementById("b"+i+"3").innerHTML=html;
}
if(data.length<timesNum)
$.each($('#b'+(data.length-1)).parent().nextAll(),
function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).attr("style","display:none");
});
$("div p").removeAttr("style");
}else{
$.each($('#b0').parent().nextAll(), function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).attr("style","display:none");
});
}
}
});
function pageClick(obj){
var id=0;
if(obj.id=="a0")
{
id="a"+(parseInt(lastPage.substring(1))-1);
}else if(obj.id=="a"+(pageTotal+1)){
id="a"+(parseInt(lastPage.substring(1))+1);
}else{
id=obj.id;
}
var html="";
//执行数据加载
var loginUserId='<%=loginUserId%>';
indexAction.getInfoMaster({num:10,pageNum:id.substring(1),loginUserId:l oginUserId},{
async : false,
callback : function(data){
if(data!=null){
var html="";
for(var i=0;i<data.length;i++)
{
html="";
if(data[i].THUMBNAIL_URL1!=null&&data[i].THUMBNAIL_URL1!=""&&data[i].TH UMBNAIL_URL1!="null")
{
html="<img
src='<%=basePath%>"+data[i].THUMBNAIL_URL1+"' width='176' height='99' />";
}else{
html="<img src='<%=basePath%>/images/noImage.jpg' width='176' height='99'' />";
}
/* $(html).appendTo($("#b"+i)); */
document.getElementById("b"+i).innerHTML=html;
html="";
html="<a id='c"+data[i].INFO_PUBLISH_ID+"'
name='d"+data[i].INFO_MASTER_ID+"' href='javascript:void(0)'
onclick='infoChecked(this)'><div
class='title'>"+data[i].INFO_NAME+"</div></a>";
document.getElementById("b"+i+"0").innerHTML=html;
html="";
/* $(html).appendTo($("#b"+i+"0")); */
if(data[i].INFO_CONTENT!=null&&data[i].INFO_CONTENT!=""&&data[i].INFO_C ONTENT!="null")
{
html=stringChange(data[i].INFO_CONTENT,70);
}
document.getElementById("b"+i+"1").innerHTML=html;
html="";
/* $(html).appendTo($("#b"+i+"1")); */
if(data[i].ORG_NAME!=null&&data[i].ORG_NAME!=undefined&&data[i].ORG_NAM E!=""&&data[i].ORG_NAME!="null")
if(data[i].ORG_NAME.length<9)
html=data[i].ORG_NAME+"&nbsp;&nbsp;&nbsp;";
else
html=data[i].ORG_NAME.substring(0,8)+"...&nbsp;&nbsp;&nbsp;";
/* html=data[i].USER_NAME+"&nbsp;&nbsp;&nbsp;"; */
html+=data[i].PUBLISH_TIME.substring(0,10);
if(data[i].INFO_TYPE_S_NAME!=null&&data[i].INFO_TYPE_S_NAME!=""&&data[i ].INFO_TYPE_S_NAME!="null")
html+="&nbsp;&nbsp;&nbsp;"+data[i].INFO_TYPE_S_NAME;
document.getElementById("b"+i+"2").innerHTML=html;
html="";
if(data[i].COMMENT_TIMES==undefined||data[i].COMMENT_TIMES==""||data[i] .COMMENT_TIMES==null||data[i].COMMENT_TIMES=="null")
data[i].COMMENT_TIMES="0";
if(data[i].SUPPORT_TIMES==undefined||data[i].SUPPORT_TIMES==""||data[i] .SUPPORT_TIMES==null||data[i].SUPPORT_TIMES=="null")
data[i].SUPPORT_TIMES="0";
if(data[i].CLICK_TIMES==undefined||data[i].CLICK_TIMES==""||data[i].CLI CK_TIMES==null||data[i].CLICK_TIMES=="null")
data[i].CLICK_TIMES="0";
html+="评价:"+data[i].COMMENT_TIMES+"&nbsp;点赞:"+data[i].SUPPORT_TIMES+"&nbsp;浏览:"+data[i].CLICK_TIMES;
document.getElementById("b"+i+"3").innerHTML=html;
/* $("#b"+i+"2").hmtl("<div>"+html+"</div>"); */
/* $("<p>"+html+"</p>").appendTo($("#b"+i+"2")); */
}
$.each($('#b0').parent().nextAll(), function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).removeAttr("style");
});
if(data.length<timesNum)
if(data.length==0)
$.each($('#b0').parent().nextAll(), function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).attr("style","display:none");
});
else
$.each($('#b'+(data.length-1)).parent().nextAll(), function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).attr("style","display:none");
});
for(var i=data.length;i<timesNum;i++)
{
html="";
document.getElementById("b"+i).innerHTML=html;
document.getElementById("b"+i+"0").innerHTML=html;
document.getElementById("b"+i+"1").innerHTML=html;
document.getElementById("b"+i+"2").innerHTML=html;
document.getElementById("b"+i+"3").innerHTML=html;
}
$("div p").removeAttr("style");
}
}
});
if(pageTotal<7){
if(id!=("a"+pageTotal)&&id!="a1")
{
html="<a id='a0' style='cursor:pointer;'
onclick='pageClick(this)'>上一页</a>&nbsp;&nbsp;&nbsp;<a id='a1'
style='cursor:pointer;' onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;";
for(var i=2;i<pageTotal;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+i+"</a>&nbsp;&nbsp;&nbsp;";
}
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
document.getElementById("page").innerHTML=html;
}else if(id=="a1"){
html="<a id='a1' style='cursor:pointer;'
onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;";
for(var i=2;i<pageTotal;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+i+"</a>&nbsp;&nbsp;&nbsp;";
}
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
document.getElementById("page").innerHTML=html;
}else{
html="<a id='a0' style='cursor:pointer;'
onclick='pageClick(this)'>上一页</a>&nbsp;&nbsp;&nbsp;<a id='a1'
style='cursor:pointer;' onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;";
for(var i=2;i<pageTotal;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+i+"</a>&nbsp;&nbsp;&nbsp;";
}
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>";
document.getElementById("page").innerHTML=html;
}
document.getElementById(lastPage).style.color="#000000";
document.getElementById(id).style.color="blue";
lastPage=id;
return;
}
var s=id;
s=s.substring(1);
if(s<=4){
if(id!=("a"+pageTotal)&&id!="a1"){
html="<a id='a0' style='cursor:pointer;'
onclick='pageClick(this)'>上一页</a>&nbsp;&nbsp;&nbsp;<a id='a1'
style='cursor:pointer;' onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;<a
id='a2' style='cursor:pointer;'
onclick='pageClick(this)'>2</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a3' style='cursor:pointer;'
onclick='pageClick(this)'>3</a>&nbsp;&nbsp;&nbsp;<a id='a4'
style='cursor:pointer;' onclick='pageClick(this)'>4</a>&nbsp;&nbsp;&nbsp;<a id='a5' style='cursor:pointer;' onclick='pageClick(this)'>5</a>...";
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
document.getElementById("page").innerHTML=html;
}else{
html="<a id='a1' style='cursor:pointer;'
onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;<a id='a2'
style='cursor:pointer;' onclick='pageClick(this)'>2</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a3' style='cursor:pointer;'
onclick='pageClick(this)'>3</a>&nbsp;&nbsp;&nbsp;<a id='a4'
style='cursor:pointer;' onclick='pageClick(this)'>4</a>&nbsp;&nbsp;&nbsp;<a id='a5' style='cursor:pointer;' onclick='pageClick(this)'>5</a>...";
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
document.getElementById("page").innerHTML=html;
}
}else if(s<=pageTotal-4){
html="<a id='a0' style='cursor:pointer;'
onclick='pageClick(this)'>上一页</a>&nbsp;&nbsp;&nbsp;<a id='a1'
style='cursor:pointer;' onclick='pageClick(this)'>1</a>...";
html+="<a id='a"+(parseInt(s)-1)+"' style='cursor:pointer;' onclick='pageClick(this)'>"+(parseInt(s)-1)+"</a>&nbsp;&nbsp;&nbsp;<a
id='a"+s+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+s+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(parseInt(s)+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>"+(parseInt(s)+1)+"</a>...<a id='a"+pageTotal+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
document.getElementById("page").innerHTML=html;
}else{
if(id!="a"+pageTotal){
html="<a id='a0' style='cursor:pointer;'
onclick='pageClick(this)'>上一页</a>&nbsp;&nbsp;&nbsp;<a id='a1'
style='cursor:pointer;' onclick='pageClick(this)'>1</a>...";
html+="<a id='a"+(pageTotal-4)+"' style='cursor:pointer;' onclick='pageClick(this)'>"+(pageTotal-4)+"</a>&nbsp;&nbsp;&nbsp;<a
id='a"+(pageTotal-3)+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+(pageTotal-3)+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal-2)+"' style='cursor:pointer;' onclick='pageClick(this)'>"+(pageTotal-2)+"</a>&nbsp;&nbsp;&nbsp;<a
id='a"+(pageTotal-1)+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+(pageTotal-1)+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"' style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
document.getElementById("page").innerHTML=html;
}else{
html="<a id='a0' style='cursor:pointer;'
onclick='pageClick(this)'>上一页</a>&nbsp;&nbsp;&nbsp;<a id='a1'
style='cursor:pointer;' onclick='pageClick(this)'>1</a>...";
html+="<a id='a"+(pageTotal-4)+"' style='cursor:pointer;' onclick='pageClick(this)'>"+(pageTotal-4)+"</a>&nbsp;&nbsp;&nbsp;<a
id='a"+(pageTotal-3)+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+(pageTotal-3)+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal-2)+"' style='cursor:pointer;' onclick='pageClick(this)'>"+(pageTotal-2)+"</a>&nbsp;&nbsp;&nbsp;<a
id='a"+(pageTotal-1)+"' style='cursor:pointer;'
onclick='pageClick(this)'>"+(pageTotal-1)+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>";
document.getElementById("page").innerHTML=html;
}
}
if(document.getElementById(lastPage)!=null&&document.getElementById(las tPage)!=undefined)
document.getElementById(lastPage).style.color="#000000";
document.getElementById(id).style.color="blue";
lastPage=id;
}
function allGet(map)
{
var temp={num:10,pageNum:1};
if(_TYPE_ID!=undefined)
_TYPE_ID=_TYPE_ID;
if(_CONTENT!=undefined)
{
_CONTENT=_CONTENT;
}
var loginUserId='<%=loginUserId%>';
if(loginUserId!=undefined&&loginUserId!=""&&loginUserId!=null) temp.loginUserId=loginUserId;
indexAction.getInfoMaster(temp,{
async : false,
callback : function(data){
if(data!=null&&data.length!=0){
var html="";
pageTotal=data[0].pageTotal;
/* var dataLength=data[0].pageTotal;
infoLebgth=data[0].pageTotal; */
if(pageTotal<7){
/* for(;dataLength-4>0;dataLength=dataLength-4)
{
pageTotal++;
} */
if(pageTotal!=1){
html="<a id='a1'
style='cursor:pointer;color:blue;'
onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;";
for(var i=2;i<pageTotal;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;' onclick='pageClick(this)'>"+i+"</a>&nbsp;&nbsp;&nbsp;";
}
html+="<a id='a"+pageTotal+"'
style='cursor:pointer;'
onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"'
style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
/* $(html).appendTo($("#page")); */
}else{
html="";
}
document.getElementById("page").innerHTML=html;
}else{
/* for(;dataLength-4>0;dataLength=dataLength-4)
{
pageTotal++;
} */
html="<a id='a1' style='cursor:pointer;color:blue;' onclick='pageClick(this)'>1</a>&nbsp;&nbsp;&nbsp;";
for(var i=2;i<5;i++)
{
html+="<a id='a"+i+"' style='cursor:pointer;' onclick='pageClick(this)'>"+i+"</a>&nbsp;&nbsp;&nbsp;";
}
html+="<a id='a5' style='cursor:pointer;'
onclick='pageClick(this)'>5</a>...";
html+="<a id='a"+pageTotal+"' style='cursor:pointer;' onclick='pageClick(this)'>"+pageTotal+"</a>&nbsp;&nbsp;&nbsp;";
html+="<a id='a"+(pageTotal+1)+"'
style='cursor:pointer;' onclick='pageClick(this)'>下一页</a>";
/* $(html).appendTo($("#page")); */
document.getElementById("page").innerHTML=html;
}
for(var i=0;i<data.length;i++)
{
html="";
if(data[i].THUMBNAIL_URL1!=null&&data[i].THUMBNAIL_URL1!=""&&data[i].TH UMBNAIL_URL1!="null")
{
html="<img
src='<%=basePath%>"+data[i].THUMBNAIL_URL1+"' width='176' height='99' />";
}else{
html="<img src='<%=basePath%>/images/noImage.jpg' width='176' height='99'' />";
}
/* $(html).appendTo($("#b"+i)); */
document.getElementById("b"+i).innerHTML=html;
html="";
html="<a id='c"+data[i].INFO_PUBLISH_ID+"'
name='d"+data[i].INFO_MASTER_ID+"' href='javascript:void(0)'
onclick='infoChecked(this)'><div
class='title'>"+data[i].INFO_NAME+"</div></a>";
document.getElementById("b"+i+"0").innerHTML=html;
html="";
/* $(html).appendTo($("#b"+i+"0")); */
if(data[i].INFO_CONTENT!=null&&data[i].INFO_CONTENT!=""&&data[i].INFO_C ONTENT!="null")
{
html=stringChange(data[i].INFO_CONTENT,70);
}
document.getElementById("b"+i+"1").innerHTML=html;
html="";
/* $(html).appendTo($("#b"+i+"1")); */
if(data[i].ORG_NAME!=null&&data[i].ORG_NAME!=undefined&&data[i].ORG_NAM E!=""&&data[i].ORG_NAME!="null")
if(data[i].ORG_NAME.length<9)
html=data[i].ORG_NAME+"&nbsp;&nbsp;&nbsp;";
else
html=data[i].ORG_NAME.substring(0,8)+"...&nbsp;&nbsp;&nbsp;";
/* html=data[i].USER_NAME+"&nbsp;&nbsp;&nbsp;"; */
html+=data[i].PUBLISH_TIME.substring(0,10);
if(data[i].INFO_TYPE_S_NAME!=null&&data[i].INFO_TYPE_S_NAME!=""&&data[i ].INFO_TYPE_S_NAME!="null")
html+="&nbsp;&nbsp;&nbsp;"+data[i].INFO_TYPE_S_NAME;
document.getElementById("b"+i+"2").innerHTML=html;
html="";
if(data[i].COMMENT_TIMES==undefined||data[i].COMMENT_TIMES==""||data[i] .COMMENT_TIMES==null||data[i].COMMENT_TIMES=="null")
data[i].COMMENT_TIMES="0";
if(data[i].SUPPORT_TIMES==undefined||data[i].SUPPORT_TIMES==""||data[i] .SUPPORT_TIMES==null||data[i].SUPPORT_TIMES=="null")
data[i].SUPPORT_TIMES="0";
if(data[i].CLICK_TIMES==undefined||data[i].CLICK_TIMES==""||data[i].CLI CK_TIMES==null||data[i].CLICK_TIMES=="null")
data[i].CLICK_TIMES="0";
html+="评价:"+data[i].COMMENT_TIMES+"&nbsp;点赞:"+data[i].SUPPORT_TIMES+"&nbsp;浏览:"+data[i].CLICK_TIMES;
document.getElementById("b"+i+"3").innerHTML=html;
/* $("#b"+i+"2").hmtl("<div>"+html+"</div>"); */
/* $("<p>"+html+"</p>").appendTo($("#b"+i+"2")); */
}
$.each($('#b0').parent().nextAll(), function () { if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).removeAttr("style");
});
if(data.length<timesNum)
$.each($('#b'+(data.length-1)).parent().nextAll(), function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).attr("style","display:none");
});
for(var i=data.length;i<timesNum;i++)
{
html="";
document.getElementById("b"+i).innerHTML=html;
document.getElementById("b"+i+"0").innerHTML=html;
document.getElementById("b"+i+"1").innerHTML=html;
document.getElementById("b"+i+"2").innerHTML=html;
document.getElementById("b"+i+"3").innerHTML=html;
}
$("div p").removeAttr("style");
}else{
$.each($('#b0').parent().nextAll(), function () {
if($(this).hasClass("newsCell")||$(this).hasClass("line"))
$(this).attr("style","display:none");
});
for(var i=0;i<timesNum;i++)
{
html="";
document.getElementById("b"+i).innerHTML=html;
document.getElementById("b"+i+"0").innerHTML=html;
document.getElementById("b"+i+"1").innerHTML=html;
document.getElementById("b"+i+"2").innerHTML=html;
document.getElementById("b"+i+"3").innerHTML=html;
document.getElementById("page").innerHTML=html;
}
}
}
});
}
<div class="main">
<div id="mainLeft">
<div class="newsCell">
<div id="b0"class="newsImage"></div>
<div class="newsRight">
<h3id="b00"></h3>
<a id="b01"href="javascript:void(0)"
onclick="infoChecked(this)"></a>
<div class="showBottom"><h4id="b02"></h4></div>
<div class="showBottomRight"><h4id="b03"></h4></div>
</div>
</div>
<div class="line"></div>
<div class="newsCell">
<div id="b1"class="newsImage"></div>
<div class="newsRight">
<h3id="b10"></h3>
<a id="b11"href="javascript:void(0)"
onclick="infoChecked(this)"></a>
<div class="showBottom"><h4id="b12"></h4></div>
<div class="showBottomRight"><h4id="b13"></h4></div>
</div>
</div>
<div class="line"></div>
<div class="newsCell">
<div id="b2"class="newsImage"></div>
<div class="newsRight">
<h3id="b20"></h3>
<a id="b21"href="javascript:void(0)"
onclick="infoChecked(this)"></a>
<div class="showBottom"><h4id="b22"></h4></div>
<div class="showBottomRight"><h4id="b23"></h4></div>
</div>
</div>
<div class="line"></div>
<div class="newsCell">
<div id="b3"class="newsImage"></div>
<div class="newsRight">
<h3id="b30"></h3>
<a id="b31"href="javascript:void(0)"
onclick="infoChecked(this)"></a>
<div class="showBottom"><h4id="b32"></h4></div>
<div class="showBottomRight"><h4id="b33"></h4></div>
</div>
</div>。

相关文档
最新文档