Html:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<title>Pick One</title>
</head>
<style type="text/css">
span{
/*display:inline;*/
margin:0 auto
}
.header
{
background: #ccc;
display: flex;
justify-content: space-between;
}
.nowtime
{
font-size:32px;
font-weight:bold;
}
.tname
{
font-size:48px;
color:#9400D3;
}
.endtime
{
font-size:32px;
color:#000F7F;
}
</style>
<script>
var Retimer=0;
var rtimr=0;
var pagecount=0;
var count=0;
var basecount=10;
var json=null;
$(document).ready(function() {
getData();
window.setInterval(function(){ getTime() },1000);
})
/*
function realSysTime(){
var now=new Date();
var year=now.getFullYear();
var month=now.getMonth();
var date=now.getDate();
var day=now.getDay();
var hour=now.getHours();
var minu=now.getMinutes();
var sec=now.getSeconds();
if(Number(sec)<10){
sec="0"+sec.toString();
}
month=month+1;
var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var week=arr_week[day];
var time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec; //组合系统时间
document.getElementById("time").innerHTML=time;
}
*/
//获取数据
function getData(){
$.ajax({
url : "http://localhost:14047/bry.ashx",//请求地址
dataType : "json",//数据格式
type : "get",//请求方式
async : false,//是否异步请求
success : function(data) { //如何发送成功
console.log(data);
console.log(data["Title"]);
document.getElementById("ttt1").innerHTML=data["Title"]; json = eval (data["Data"]);
Retimer=data["RefreshTime"];
rtimr=Retimer;
show(json);
},
})
} //数据分页
function show(json){
var flg=false;
$("#table tr:not(:first)").html("");//清空表格内容
var nowcount=pagecount*basecount+basecount;
if(nowcount>=json.length)
{
flg=true;
nowcount=json.length;
}
for(var i=0 +pagecount*basecount;i< nowcount;i++){ //遍历data数组
var row=table.insertRow(table.rows.length);
var c1=row.insertCell(0);
c1.innerHTML=json[i].ID;
var c2=row.insertCell(1);
c2.innerHTML=json[i].Name;
var c3=row.insertCell(2);
c3.innerHTML=json[i].Age;
count=count++;
}
pagecount=pagecount+1;
if(flg)
{
pagecount=0;
count=0;
}
} //定时
function getTime(){
document.getElementById("countdown").innerHTML=Retimer;
Retimer=Retimer-1;
if(Retimer==-1)
{
show(json)
Retimer= rtimr;
}
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() +1;
var day = now.getDate();
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getSeconds();
var clock = year + "-"; if(month < 10)
clock += "0"; clock += month + "-"; if(day < 10)
clock += "0"; clock += day + " "; if(hh < 10)
clock += "0"; clock += hh + ":";
if (mm < 10) clock += '0';
clock += mm + ":"; if (ss < 10) clock += '0';
clock += ss;
document.getElementById("time").innerHTML=clock;
}
</script>
<body>
<div class="header">
<span class="nowtime" id='time'></span>
<span class="tname" id='ttt1'></span>
<span class="endtime">倒计时
<span class="timecountdown" id='countdown'></span>
</span>
</div> <div>
<table id='table' class="table table-bordered table table-info table-hover">
<thead class="text-center">
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
</table>
</div>
</body>
</html>

  后端:.NET  ashx

    public class bry: IHttpHandler
{ public void ProcessRequest(HttpContext context)
{
Dictionary<string, object> param = new Dictionary<string, object>();
string ret = "";
DataTable dt = new DataTable();//创建表
dt.Columns.Add("ID", typeof(Int32));//添加列
dt.Columns.Add("Name", typeof(String));
dt.Columns.Add("Age", typeof(Int32));
dt.Rows.Add(new object[] { 1, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 2, "李四", 25 });
dt.Rows.Add(new object[] { 3, "王五", 30 });
dt.Rows.Add(new object[] { 4, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 5, "李四", 25 });
dt.Rows.Add(new object[] { 6, "王五", 30 });
dt.Rows.Add(new object[] { 7, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 8, "李四", 25 });
dt.Rows.Add(new object[] { 9, "王五", 30 });
dt.Rows.Add(new object[] { 10, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 11, "李四", 25 });
dt.Rows.Add(new object[] { 12, "王五", 30 });
dt.Rows.Add(new object[] { 13, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 14, "李四", 25 });
dt.Rows.Add(new object[] { 15, "王五", 30 });
dt.Rows.Add(new object[] { 16, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 17, "李四", 25 });
dt.Rows.Add(new object[] { 18, "王五", 30 });
dt.Rows.Add(new object[] { 19, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 20, "李四", 25 });
dt.Rows.Add(new object[] { 21, "王五", 30 });
dt.Rows.Add(new object[] { 22, "王五", 30 });
dt.Rows.Add(new object[] { 23, "王五", 30 });
dt.Rows.Add(new object[] { 24, "王五", 30 });
dt.Rows.Add(new object[] { 25, "王五", 30 });
dt.Rows.Add(new object[] { 26, "王五", 30 });
dt.Rows.Add(new object[] { 27, "王五", 30 });
dt.Rows.Add(new object[] { 28, "王五", 30 });
dt.Rows.Add(new object[] { 29, "王五", 30 });
dt.Rows.Add(new object[] { 30, "王五", 30 });
dt.Rows.Add(new object[] { 41, "李四", 25 });
dt.Rows.Add(new object[] { 42, "王五", 30 });
dt.Rows.Add(new object[] { 43, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 44, "李四", 25 });
dt.Rows.Add(new object[] { 45, "王五", 30 });
dt.Rows.Add(new object[] { 46, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 47, "李四", 25 });
dt.Rows.Add(new object[] { 48, "王五", 30 });
dt.Rows.Add(new object[] { 49, "张三", 20 });//添加行
dt.Rows.Add(new object[] { 50, "李四", 25 });
dt.Rows.Add(new object[] { 51, "王五", 30 });
dt.Rows.Add(new object[] { 52, "王五", 30 });
dt.Rows.Add(new object[] { 53, "王五", 30 });
dt.Rows.Add(new object[] { 54, "王五", 30 });
dt.Rows.Add(new object[] { 55, "王五", 30 }); string data = JsonConvert.SerializeObject(dt, new DataTableConverter()); param.Add("Title", "Witch One");
param.Add("RefreshTime", 5);
param.Add("NowTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
param.Add("Data", data);
ret = JsonConvert.SerializeObject(param);
context.Response.AddHeader("Access-Control-Allow-Origin", "*");
context.Response.ContentType = "text/html";
context.Response.Write(ret);
} public bool IsReusable
{
get
{
return false;
}
}
}

  

Html5分页显示Table的更多相关文章

  1. Table分页显示调整

    这是table分页显示的代码,下面是对应调整的代码 /*分页调整*/ .fenye .dataTables_info{ line-height: 28px; } .fenye .pagination{ ...

  2. C#关于分页显示

    ---<PS:本人菜鸟,大手子还请高台贵手> 以下是我今天在做分页时所遇到的一个分页显示问题,使用拼写SQL的方式写的,同类型可参考哦~ ------------------------- ...

  3. JSP分页显示实例(基于Bootstrap)

    首先介绍一款简单利落的分页显示利器:bootstrap-paginator 效果截图: GitHub官方下载地址:https://github.com/lyonlai/bootstrap-pagina ...

  4. JSP分页显示

    首先要定义四个变量: int pageSize: //每页显示多少条记录 int pageNow: //希望显示第几页 int pageCount: //一共有多少页 int rowCount: // ...

  5. php中关于 left join 的分页显示

    /* * 统计商机搜索总条数信息 * ftt * 2015-11-10 10:13:15 */ public function getBusinessCount($btype='',$buname=' ...

  6. SSh结合Easyui实现Datagrid的分页显示

    近日学习Easyui,发现非常好用,界面很美观.将学习的心得在此写下,这篇博客写SSh结合Easyui实现Datagrid的分页显示,其他的例如添加.修改.删除.批量删除等功能将在后面的博客一一写来. ...

  7. java web 简单的分页显示

    题外话:该分页显示是用 “表示层-控制层-DAO层-数据库”的设计思想实现的,有什么需要改进的地方大家提出来,共同学习进步. 思路:首先得在 DAO 对象中提供分页查询的方法,在控制层调用该方法查到指 ...

  8. 实例:SSh结合Easyui实现Datagrid的分页显示

    近日学习Easyui,发现非常好用,界面很美观.将学习的心得在此写下,这篇博客写SSh结合Easyui实现Datagrid的分页显示,其他的例如添加.修改.删除.批量删除等功能将在后面的博客一一写来. ...

  9. 转:JSP 分页显示数据 (Oracle)

    JSP 分页显示数据 (Oracle) 标签: Oracle分页JSP分页 2013-11-19 20:40 3598人阅读 评论(1) 收藏 举报  分类: Web(11)  版权声明:本文为博主原 ...

随机推荐

  1. 地址解析协议ARP与逆地址解析协议RARP

    IP地址是用来通信的,但是和硬件地址是有区别的.物理地址是数据链路层和物理层使用的地址,IP地址是网络层及以上各层使用的地址. 发送数据时,数据从高层向下层传输,使用IP地址的IP数据报交给下层的数据 ...

  2. Python源码剖析——02虚拟机

    <Python源码剖析>笔记 第七章:编译结果 1.大概过程 运行一个Python程序会经历以下几个步骤: 由解释器对源文件(.py)进行编译,得到字节码(.pyc文件) 然后由虚拟机按照 ...

  3. Adaptive Threshold

    Adaptive Threshold 1. Otsu's Binarization: Using a discriminant analysis to partition the image into ...

  4. Vue dynamic component All In One

    Vue dynamic component All In One Vue 动态组件 vue 2.x https://vuejs.org/v2/guide/components-dynamic-asyn ...

  5. how to read the 10th line of a text using shell script

    how to read the 10th line of a text using shell script shell script / bash script question https://l ...

  6. frontends tools

    frontends tools figma free online UI 可视化埋点 https://www.figma.com/files/recent cypress testing $ npm ...

  7. css3 units & 1 turn

    css3 units & 1 turn One full circle is 1turn, 180deg === 0.5turn degrees, gradians, radians, tur ...

  8. npm install 原理

    npm install 原理 https://docs.npmjs.com/about-npm/ npm consists of three distinct components: the webs ...

  9. NGK生态之星空计划启动在即,稀有VAST高兑换比带来高价值!

    NGK生态之星空计划启动在即,为了感谢NGK布道者的支持,NGK官方将全力辅助算力市场,开展全新的星空计划,并发行星空币SPC,空投给算力持有者进行额外奖励. 至此,SPC已经顺利完成2轮空投,也初步 ...

  10. NGK——更好的数据与网络

    对于NGK而言,帐本是不可或缺的,所以NGK有独立的共识层,共识层有单独的参与的共识节点.而其余计算都丢给其他的计算资源计算,共识层汇总一个正确的结果即可. 进行大量计算过程的资源是另一种节点,在NG ...