原料库管理 <script> <br>function Page(iAbsolute,sTableId,sTBodyId,page) <br>{ <br>this.absolute = iAbsolute; //每页最大记录数 <br>this.tableId = sTableId; <br>this.tBodyId = sTBodyId; <br>this.rowCount = 0;//记录数 <br>this.pageCount = 0;//页数 <br>this.pageIndex = 0;//页索引 <br>this.__oTable__ = null;//表格引用 <br>this.__oTBody__ = null;//要分页内容 <br>this.__dataRows__ = 0;//记录行引用 <br>this.__oldTBody__ = null; <br>this.__init__(); //初始化; <br>}; <br>/**//* <br>Initialization <br>*/ <br>Page.prototype.__init__ = function(){ <br>this.__oTable__ = document.getElementById(this.tableId);//获取table引用 <br>this.__oTBody__ = this.__oTable__.tBodies[this.tBodyId];//获取tBody引用 <br>this.__dataRows__ = this.__oTBody__.rows; <br>this.rowCount = this.__dataRows__.length; <br>try{ <br>this.absolute = (this.absolute <= 0) || (this.absolute>this.rowCount) ? this.rowCount : this.absolute; <br>this.pageCount = parseInt(this.rowCount%this.absolute == 0 <br>? this.rowCount/this.absolute : this.rowCount/this.absolute 1); <br>}catch(exception){} <br>this.__updateTableRows__(); <br>}; <br>Page.prototype.GetBar=function(obj) <br>{ <br>var bar= document.getElementById(obj.id); <br>bar.innerHTML= "每页" this.absolute "条/共" this.rowCount "条";// 第2页/共6页 首页 上一页 1 2 3 4 5 6 下一页 末页 <br>} <br>/**//* <br>Next page <br>*/ <br>Page.prototype.nextPage = function(){ <br>if(this.pageIndex 1 < this.pageCount){ <BR>this.pageIndex = 1; <BR>this.__updateTableRows__(); <BR>} <BR>}; <BR>/**//* <BR>Previous page <BR>*/ <BR>Page.prototype.prePage = function(){ <BR>if(this.pageIndex >= 1){ <br>this.pageIndex -= 1; <br>this.__updateTableRows__(); <br>} <br>}; <br>/**//* <br>Homepage <br>*/ <br>Page.prototype.firstPage = function(){ <br>if(this.pageIndex != 0){ <br>this.pageIndex = 0; <br>this.__updateTableRows__(); <br>} <br>}; <br>/**//* <br>Last page <br>*/ <br>Page.prototype.lastPage = function(){ <br>if(this.pageIndex 1 != this.pageCount){ <br>this.pageIndex = this.pageCount - 1; <br>this.__updateTableRows__(); <br>} <br>}; <br>/**//* <br>Page positioning method <br>*/ <br>Page.prototype.aimPage = function(){ <br>var abc = document.getElementById("pageno"); <br>var iPageIndex = abc.value; <br>var iPageIndex = iPageIndex*1; <br>if(iPageIndex > this.pageCount-1){ <br>this.pageIndex = this.pageCount -1; <br>}else if(iPageIndex < 0){ <BR>this.pageIndex = 0; <BR>}else{ <BR>this.pageIndex = iPageIndex-1; <BR>} <BR>this.__updateTableRows__(); <BR>}; <BR>/**//* <BR>When performing paging, update the displayed table content <BR>*/ <BR>Page.prototype.__updateTableRows__ = function(){ <BR>var iCurrentRowCount = this.absolute * this.pageIndex; <BR>var iMoreRow = this.absolute iCurrentRowCount > this.rowCount ? this.absolute iCurrentRowCount - this.rowCount : 0; <br>var tempRows = this.__cloneRows__(); <br>var removedTBody = this.__oTable__.removeChild(this.__oTBody__); <br>var newTBody = document.createElement("TBODY"); <br>newTBody.setAttribute("id", this.tBodyId); <br>for(var i=iCurrentRowCount; i < this.absolute iCurrentRowCount-iMoreRow; i ){ <BR>newTBody.appendChild(tempRows[i]); <BR>} <BR>this.__oTable__.appendChild(newTBody); <BR>this.__dataRows__ = tempRows; <BR>this.__oTBody__ = newTBody; <BR>//页脚显示分 <BR>var divFood = document.getElementById("divFood");//分页工具栏 <BR>divFood.innerHTML=""; <BR>var rightBar = document.createElement("divFood"); <BR>rightBar.setAttribute("display",""); <BR>rightBar.setAttribute("float","left"); <BR>rightBar.innerHTML="第" (this.pageIndex 1) "页/共" this.pageCount "页"; <BR>var isOK="Y"; <BR>var cssColor=""; <BR>divFood.appendChild(rightBar); <BR>////页脚显示分页结 <BR>}; <BR>/**//* <BR>Clone the original operation row collection <BR>*/ <BR>Page.prototype.__cloneRows__ = function(){ <BR>var tempRows = []; <BR>for(var i=0; i<this.__dataRows__.length; i ){ <BR>tempRows[i] = this.__dataRows__[i].cloneNode(1); <BR>} <BR>return tempRows; <BR>}; <BR></script>
编号 |
|
名称 |
数量 |
单价 |
|
酒店名称 |
备注 |
1 |
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
3 |
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
5 |
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
8 |
|
|
|
|
|
|
|
9 |
|
"javascript"> スクリプト>
🎜>
声明:この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。