国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

js表格分頁實現代碼

2024-05-06 14:13:48
字體:
來源:轉載
供稿:網友

代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta content="all" name="robots" />
<meta name="Copyright" content="" />
<meta name="description" content="" />
<meta content="" name="keywords" />
<link rel="stylesheet" type="text/css" href="css.css" />
<title>原料庫管理</title>
<script>
function Page(iAbsolute,sTableId,sTBodyId,page)
{
this.absolute = iAbsolute; //每頁最大記錄數
this.tableId = sTableId;
this.tBodyId = sTBodyId;
this.rowCount = 0;//記錄數
this.pageCount = 0;//頁數
this.pageIndex = 0;//頁索引
this.__oTable__ = null;//表格引用
this.__oTBody__ = null;//要分頁內容
this.__dataRows__ = 0;//記錄行引用
this.__oldTBody__ = null;
this.__init__(); //初始化;
};
/**//*
初始化
*/
Page.prototype.__init__ = function(){
this.__oTable__ = document.getElementById(this.tableId);//獲取table引用
this.__oTBody__ = this.__oTable__.tBodies[this.tBodyId];//獲取tBody引用
this.__dataRows__ = this.__oTBody__.rows;
this.rowCount = this.__dataRows__.length;
try{
this.absolute = (this.absolute <= 0) || (this.absolute>this.rowCount) ? this.rowCount : this.absolute;
this.pageCount = parseInt(this.rowCount%this.absolute == 0
? this.rowCount/this.absolute : this.rowCount/this.absolute+1);
}catch(exception){}
this.__updateTableRows__();
};
Page.prototype.GetBar=function(obj)
{
var bar= document.getElementById(obj.id);
bar.innerHTML= "每頁"+this.absolute+"條/共"+this.rowCount+"條";// 第2頁/共6頁 首頁 上一頁 1 2 3 4 5 6 下一頁 末頁
}
/**//*
下一頁
*/
Page.prototype.nextPage = function(){
if(this.pageIndex + 1 < this.pageCount){
this.pageIndex += 1;
this.__updateTableRows__();
}
};
/**//*
上一頁
*/
Page.prototype.prePage = function(){
if(this.pageIndex >= 1){
this.pageIndex -= 1;
this.__updateTableRows__();
}
};
/**//*
首頁
*/
Page.prototype.firstPage = function(){
if(this.pageIndex != 0){
this.pageIndex = 0;
this.__updateTableRows__();
}
};
/**//*
尾頁
*/
Page.prototype.lastPage = function(){
if(this.pageIndex+1 != this.pageCount){
this.pageIndex = this.pageCount - 1;
this.__updateTableRows__();
}
};
/**//*
頁定位方法
*/
Page.prototype.aimPage = function(){
var abc = document.getElementById("pageno");
var iPageIndex = abc.value;
var iPageIndex = iPageIndex*1;
if(iPageIndex > this.pageCount-1){
this.pageIndex = this.pageCount -1;
}else if(iPageIndex < 0){

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 栾城县| 同仁县| 五华县| 方正县| 瓦房店市| 泾阳县| 永宁县| 嘉善县| 龙海市| 红原县| 高阳县| 岗巴县| 金塔县| 双城市| 日土县| 霍山县| 巴林右旗| 大宁县| 微山县| 布尔津县| 夏邑县| 工布江达县| 芮城县| 昌平区| 永和县| 会昌县| 呼图壁县| 澄城县| 盖州市| 攀枝花市| 高台县| 本溪| 慈利县| 永新县| 贺兰县| 新邵县| 扶沟县| 织金县| 丹凤县| 永仁县| 大姚县|