<html>
<head>
<script>
var CurrentPage=0;
function show(page)
{
if (page<=0)
{
//document.getElementById("paging").innerHTML="";
alert("page not found");
//document.getElementById("paging").innerHTML="Page is blank";
showFisrt();
CurrentPage++;
return;
}
if (page>=4)
{
//document.getElementById("paging").innerHTML="";
alert("page not found");
//document.getElementById("paging").innerHTML="Page is blank";
showLast();
CurrentPage--;
return;
}
if (window.XMLHttpRequest)
{
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行
xmlhttp=new XMLHttpRequest();
}
else
{
// IE6, IE5 浏览器执行
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("paging").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","process.php?page="+page,true);
xmlhttp.send();
};
</script>
<style type="text/css">
.table td{
border: 1px solid cornflowerblue;
color:black;
width:90px;
}
</style>
</head>
<body>
<div class="table" align="center">
<h3>学生信息</h3>
<form>
<table class="table">
<tr>
<td>学号</td>
<td>姓名</td>
<td>性别</td>
<td>年龄</td>
<td>籍贯</td>
<td>班级</td>
</tr>
</table>
</table>
<table class="table" id="paging">
<tr><td>Page is Blank</td></tr>
</table>
</form>
<div><button id="prev">上一页</button><span id="num1"> 1 </span><span id="num2"> 2 </span><span id="num3"> 3 </span><button id="next">下一页</button></div>
</body>
<script>
//展示第一次的主页面
function showFirst()
{
CurrentPage=1;
alert(CurrentPage);
show(CurrentPage);
//window.location.href="www.baidu.com";
showNum(CurrentPage);
}
function showLast()
{
CurrentPage=3;
alert(CurrentPage);
show(CurrentPage);
//window.location.href="www.baidu.com";
showNum(CurrentPage);
}
window.onload=showFirst();
//上下页点击事件
var prev=document.getElementById("prev");
var next=document.getElementById("next");
prev.addEventListener("click",function()
{
CurrentPage--;
alert(CurrentPage);
show(CurrentPage);
//window.location.href="www.baidu.com";
showNum(CurrentPage);
}
);
next.addEventListener("click",function()
{
CurrentPage++;
alert(CurrentPage);
show(CurrentPage);
//window.location.href="www.baidu.com";
showNum(CurrentPage);
}
);
function showNum(Page)
{
var num1=document.getElementById("num1");
var num2=document.getElementById("num2");
var num3=document.getElementById("num3");
if(Page==1)
{
num1.style.color="red";
num2.style.color="Black";
num3.style.color="Black";
}
else if(Page==2)
{
num1.style.color="Black";
num2.style.color="red";
num3.style.color="Black";
}
else if(Page==3)
{
num1.style.color="Black";
num2.style.color="Black";
num3.style.color="red";
}
else
{
num1.style.color="Black";
num2.style.color="Black";
num3.style.color="Black";
}
}
</script>
</html>
分页_分页实现数据表_源码
版权申诉
160 浏览量
2021-09-29
16:05:43
上传
评论
收藏 73KB RAR 举报
爱牛仕
- 粉丝: 96
- 资源: 4716
最新资源
- 简单的Python示例,演示了如何使用TCP/IP协议进行基本的客户端和服务器通信
- 考试.sql
- keil2 + proteus + 8051.exe
- 1961ee27df03bd4595d28e24b00dde4e_744c805f7e4fb4d40fa3f695bfbab035_8(1).c
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- windows注册表编辑工具
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- 校园通行码预约管理系统20240522075502
- 车类型数据集6250张VOC+YOLO格式.zip
- The PyTorch implementation of STGCN.STGCN-main.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0