jquery 实现无刷新分页代码实现

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<%@pageimport="java.util.*"%>

<%@pageimport="com.siku.bean.*"%>

<%@tagliburi="http://www.codingfarmer.com/tags"prefix="util"%>

<scripttype="text/javascript"src="scripts/jquery-1.4.2.min.js"></script>

<script>

varmaxpage=1;

varcurrpage=1;

alert(2222);

$.ajax({

url:"http://121.101.216.142:8270/OMoney/Mixi_Buy?userId=29426397&type=1",

cache:"false",

success:function(html){

//update

maxpage=html;

alert(maxpage);

$("#cm").empty();

$("#cm").append(currpage+"/"+maxpage);

}

});

findAll(1);

functionhome(){

if(currpage>1){

findAll(1);

currpage=1;

document.getElementById("cm").innerHTML=currpage+"/"+maxpage;

}

}

functionlast(){

if(currpage<maxpage){

findAll(maxpage);

currpage=maxpage

document.getElementById("cm").innerHTML=currpage+"/"+maxpage;

}

}

functionbefore(){

if(currpage>1){

currpage-=1;

findAll(currpage);

document.getElementById("cm").innerHTML=currpage+"/"+maxpage;

}

}

functionnext(){

if(currpage<maxpage){

currpage+=1;

findAll(currpage);

document.getElementById("cm").innerHTML=currpage+"/"+maxpage;

}

}

functiongetmaxpage(){

alert(2222);

$.ajax({

url:"http://121.101.216.142:8270/OMoney/Mixi_Buy?userId=29426397&type=1",

cache:"false",

success:function(html){

//update

maxpage=html;

alert(maxpage);

$("#cm").empty();

$("#cm").append(currpage+"/"+maxpage);

}

});

findAll(1);

}

functionfindAll(currpage){

$

.ajax({

url:"http://121.101.216.142:8270/OMoney/Mixi_Buy?userId=29426397&type=0&page="

+currpage,

cache:"false",

success:function(html){

$("#tbl").empty();

if(html!=""){

$("#tbl")

.append(

"<tr><tdwidth='324'align='center'>番号</td><tdwidth='191'align='center'>チャージ日時</td><tdwidth='271'align='center'>お預け入れ(円)</td><tdwidth='271'align='center'>○貨</td><tdwidth='271'align='center'>決済方法</td></tr>");

varusertaskvc=html.split("+");

for(vari=0;i<usertaskvc.length-1;i++){

$("#tbl").append(

"<trid='tr"+i+"'><td>"

+usertaskvc[i].split("|")[0]

+"</td><td>"

+usertaskvc[i].split("|")[1]

+"</td><td>"

+usertaskvc[i].split("|")[2]

+"</td><td>"

+usertaskvc[i].split("|")[3]

+"</td><td>"

+usertaskvc[i].split("|")[4]

+"</td></tr>");

}

}else{

alert("没有数据!");

}

}

});

}

</script>

<!--topcontent-->

<divclass="nav">

<ul>

<li><ahref="mixi_index.html">O貨購入</a></li>

<li><ahref="mixi_buy.jsp"class="cur">チャージ履歴</a></li>

<li><ahref="mixi_consume.jsp">O貨履歴</a></li>

</ul>

<divclass="nav_R">所有O貨:<strongclass="red">0</strong>

&nbsp;&nbsp;O貨購入する金額を選んでください。</div>

<divclass="clear"></div>

</div>

<!--endtopcontent-->

<tableid="tbl"width="800"height="32"border="1"align="left"

cellpadding="0"cellspacing="0"bordercolor="#0099CC"class="tablecss">

</table>

<tablewidth="200"border="1"cellpadding="0"cellspacing="0">

<tralign="center">

<td><ahref="#"onclick=

home();

>home</a></td>

<td><ahref="#"onclick=

before();

>before</a></td>

<td><ahref="#"onclick=

next();

>next</a></td>

<td><ahref="#"onclick=

last();

>last</a></td>

</tr>

<tr>

<tdcolspan="4"align="center"id="cm">xx/xx</td>

</tr>

</table>

相关推荐