我有一个简单的分页分页代码,它是用原始 javascript 代码编写的
function ChangeForumPage(e){
if(busy == 0)
{
switch(e)
{
case "Next":
page = p+1;
p++;
break;
case "Prev":
if(p>1)
{
page = p-1;
p--;
}
break;
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="MTForumsBlock.php?req=LastTopics&p="+page;
xmlHttp.onreadystatechange=ChangeForumPageProces;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
function ChangeForumPageProces(e){
if(xmlHttp.readyState==4)
{
document.getElementById("MTForumBlock").innerHTML=xmlHttp.responseText;
document.getElementById("MTFloader").innerHTML='';
busy = 0;
}else{
document.getElementById("MTFloader").innerHTML='<img src="images/loader.gif" />';
busy = 1;
}
}
我需要和 jquery 有同样的可能性
但我不知道该怎么做!
如果我点击下一个或上一个按钮,它应该只改变页面
最佳答案
您可能想改用 jQuery 分页插件,它们开箱即用,您只需指定您的设置:
关于javascript - 将javascript中的简单分页转换为jquery代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3538601/