单纯用<th><td>写的表格,分页实现

本文介绍了如何使用纯HTML和JavaScript实现表格数据的分页功能。通过点击上一页、下一页按钮或输入页码直接跳转,动态加载不同页面的数据。JavaScript代码中包含lastPage、nextPage和goPageByNum函数,分别处理前后翻页和指定页码跳转,同时与后台进行交互获取数据。
摘要由CSDN通过智能技术生成

1、html:

<div id="tableList">
    <table class="table table-bordered table-striped table-hover" id="rgtable1" style="color:#444444">
        <thead>
        <tr>
            <th>角色</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <#list urlBeanList as urlBean>
        <tr class="odd">
            <td><#if urlBean.urlType?exists>${urlBean.urlType}<#else>无</#if></td>
            <td>
                <button class="buttonnew button--winona2 button--round-l button--border-thin"
                        οnclick="urlLookUp('${urlBean.urlType}')"><span><span>查看</span></span>
                </button>
                <button class="buttonnew button--winona2 button--round-l button--border-thin"
                        οnclick="urlUpdate('${urlBean.urlType}')"><span><span>修改</span></span>
                </button>
                <button class="buttonnew button--winona2 button--round-l button--border-thin" οnclick="urlDelete('${urlBean.urlType}')">
                    <span><span>删除</span></span></button>
            </td>
        </tr>
        </#list>
        </tbody>
    </table>
    <#if pages??>
      <div class="pageNu" align="right">
      总共 ${pages?c}页|第${currentpage?c}页
           <#if (currentpage>1)>
            <a style='cursor:pointer;' onclick = lastPage('${currentpage?c}')>上一页</a>
           <#else>
           </#if>
           <#if (currentpage<pages)>
            <a style='cursor:pointer;' onclick = nextPage('${currentpage?c}')>下一页</a>
           <#else>
           </#if>
          转至<input type="text" name="pageNum" id="pageNum" value="${curr

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<html> <head> <title>人员管理界面</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script> </head> <body> <div class="container"> <div class="row clearfix"> <div class="col-md-12 column"> <div class="page-header"> <h1> <small>员工列表 —— 显示所有员工信息</small> </h1> </div> </div> </div> <div class="row clearfix"> <div class="col-md-12 column"> <table class="table table-hover table-striped"> <thead> <tr> <th>ID</th> <th>姓名</th> <th>电话号</th> <th>地址</th> <th>职位</th> <th>职位编号</th> <th>状态</th> <th>证件照</th> </tr> </thead> <tbody> <c:forEach items="${employees}" var="employees"> <tr> <td>${employees.id}</td> <td>${employees.name}</td> <td>${employees.phonenumber}</td> <td>${employees.address}</td> <td>${employees.job}</td> <td>${employees.jobid}</td> <td>${employees.state}</td> <td><img src="${pageContext.request.contextPath}/images/${employees.pic}" style="width: 100px; height: 50px"></td> <td> <a href="${pageContext.request.contextPath}/toupdate/${employees.id}">更改</a> | <a href="${pageContext.request.contextPath}/delete/${employees.id}" onclick="return confirm('确定要删除吗?')">删除</a> </td> </tr> </c:forEach> </tbody> </table> </div> </div> </div> </body> </html>给这个界面的表格实现一个分页的功能,每页的最大数目为5
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值