html显示

  <center>
<div id="fyh">
<ul class="pagination" id="fy_list"> </ul>
</div>
<input type="hidden" value="" id="fy_n" />
</center>

ajax

 $(document).ready(function(e){
JiaZai();
//确定总页数的变量
var zys = 0;
//查询数据 }); //加载数据方法
function JiaZai()
{
var n = $("#fy_n").val(); $.ajax({
url:"./chuli/htshjchuli.php",
async:false,
data:{n:n,tp:1},
type:"POST",
dataType:"TEXT",
success: function(data){
var s ="";
var hang = data.split("|");
var strs = "";
for(var i=0;i<hang.length;i++)
{
var lie = hang[i].split("^");
strs+="<div class='htcontent htcontent1'>"+lie[0]+"</div><div class='htcontent htcontent2'>"+lie[1]+"</div><div class='htcontent htcontent3'>"+lie[2]+"</div><div class='htcontent htcontent4'>"+lie[3]+"</div><div class='htcontent htcontent5'>"+lie[4]+"</div><div class='htcontent htcontent6 ' style='color:"+color+"'><a class='shenhe"+lie[5]+"' shbs='"+lie[0]+"'>"+shenhe+"</a></div>"; }
$("#htrecords_nr").html(strs); }
});
shenheshijian();
//获取分页数(列表)
$.ajax({
url:"./chuli/htshjchuli.php",
data:{tp:2},
type:"POST",
dataType:"TEXT",
success: function(data){
//总页数
var ys = Math.ceil(data/10);
zys = ys;
var cd = zys*48;
if(zys<5){
$("#fyh").css("width",cd+"px"); }else{
$("#fyh").css("width","235px");
} var s = "";
//var s = "<li><a id='fy_shang'>&laquo;</a></li>";
var dangqian = parseInt($("#fy_n").val()); //当前页数 if(dangqian==1){
for(var i=dangqian;i<=dangqian+4;i++){
if(i>0 && i<=ys)
{
if(dangqian==i)
{
s+="<li class='active fy_zhong' style='background-color:#faa66a; color:#FFF'><a>"+i+"</a></li>";
}
else
{
s+="<li class='fy_zhong'><a>"+i+"</a></li>"
}
}
}
}else if(dangqian==2){
for(var i=dangqian-1;i<=dangqian+3;i++){
if(i>0 && i<=ys)
{
if(dangqian==i)
{
s+="<li class='active fy_zhong' style='background-color:#faa66a; color:#FFF'><a>"+i+"</a></li>";
}
else
{
s+="<li class='fy_zhong'><a>"+i+"</a></li>"
}
}
}
}else if(dangqian==zys){
for(var i=dangqian-4;i<=dangqian;i++){
if(i>0 && i<=ys)
{
if(dangqian==i)
{
s+="<li class='active fy_zhong' style='background-color:#faa66a; color:#FFF'><a>"+i+"</a></li>";
}
else
{
s+="<li class='fy_zhong'><a>"+i+"</a></li>"
}
}
}
}else if(dangqian==zys-1){
for(var i=dangqian-3;i<=dangqian+1;i++){
if(i>0 && i<=ys)
{
if(dangqian==i)
{
s+="<li class='active fy_zhong' style='background-color:#faa66a; color:#FFF'><a>"+i+"</a></li>";
}
else
{
s+="<li class='fy_zhong'><a>"+i+"</a></li>"
}
}
} }else{
for(var i=dangqian-2;i<=dangqian+2;i++){
if(i>0 && i<=ys)
{
if(dangqian==i)
{
s+="<li class='active fy_zhong' style='background-color:#faa66a; color:#FFF'><a>"+i+"</a></li>";
}
else
{
s+="<li class='fy_zhong'><a>"+i+"</a></li>"
}
}
}
}
//s += "<li><a id='fy_xia'>&raquo;</a></li>";
$("#fy_list").html(s); //给分页列表加事件
JiaShiJian();
}
})
}
//给分页列表加事件的方法
function JiaShiJian()
{
/* $("#fy_shang").click(function(){ var n = $("#fy_n").val();
if(n>1)
{
n--;
}
else
{
n=1;
}
$("#fy_n").val(n); //加载数据
JiaZai();
})
$("#fy_xia").click(function(){
var n = $("#fy_n").val();
if(n<zys)
{
n++;
}
else
{
n=zys;
}
$("#fy_n").val(n); //加载数据
JiaZai();
})*/
$(".fy_zhong").click(function(){
var n = $(this).text();
$("#fy_n").val(n);
//加载数据
JiaZai();
}) }

处理

 $n = $_POST["n"];
$tg = ($n-1)*10;
$xxlb = "select * from xinxi order by number desc limit {$tg},10";
echo $db->STRQuery($xxlb);

$xxys = "select count(*) from goumai"; echo $db->StrQuery($xxys);

function zishu(){
$(".nr_nei_s").each(function(){
//限制字符个数
var maxwidth=;
if($(this).text().length>maxwidth){
$(this).text($(this).text().substring(,maxwidth));
$(this).html($(this).html()+'…');
}
}); } function getYmdTime(time){
if(time > ){
var dateStr = new Date(time);
return dateStr.getFullYear() + '-' + dateStr.getMonth()+ +'-' + dateStr.getDate() + ' ' + dateStr.getHours() + ':' + dateStr.getMinutes() + ':' + dateStr.getSeconds();
}else{
return '末知时间';
}
}
05-11 17:43