`
king6860
  • 浏览: 2883 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

自己写了个分页的JS 类函数,把它封装好后,测试的过程中,却出现个奇怪的问题!!

阅读更多
首先,我把出错的原因给大家说一下,下面是  测试页面的部分代码,
当我在加入 <form></form> 标签之后, 当点击'GO' 按钮的时候,
就出现了莫名其妙的错误: '对象不支持此属性或方法',
当把 <form></form> 删除以后,就正常了。
这个问题困扰我许久了,希望大家把帮我看一下,到底是哪个地方的代码出现了错误。。。

<!-- <form> -->
<table  width="98%"  border="0" align="center" cellpadding="4" cellspacing="0" class="frame" >
<thead>
<tr>
<td align='center' colspan="" id='page'>
<script>
var url = "/Lottery.do?op=forwardAddPaiLie3";
var page1 = new pageObject(url,1,45,450,"page1");

</script>
</td>
</tr>
</thead>
</table>
<!-- </form> -->


下面是 JS 函数。
// 校验数字
<script>
function checkNumber(obj)
{
var reg = /[1-9]{1}([0-9]*)$/;
return reg.test(obj);
}

function pageObject(url,currentPage,totalPage,recordSize)
{
         // 对象名称
_OBJ_NAME = this;
         // 查询的URL 和QueryString
this.url = url;
         // 当前页
this.currentPage = currentPage;
         // 共多少页
this.totalPage = totalPage;
         // 共多少条记录
this.recordSize = recordSize;
// document.write 的字符串
this.toWrite = "";

         // 初始化函数
this.init = function()
{
if(this.totalPage == 1 && this.currentPage == 1)
{
this.toWrite="(第<font color=blue>"+this.currentPage+"</font>/"+this.totalPage+"页 共"+this.recordSize+"条)";
this.toWrite += "&nbsp;首页&nbsp;上一页&nbsp;下一页&nbsp;末页&nbsp;<input id='forwardPage' size='4' value='' style='ime-mode:disabled;'>&nbsp;<input type='button' value=' GO ' class='button' onclick='"+"_OBJ_NAME.fnForward()'>";
}else if(this.totalPage > 1 && this.currentPage==1)
{
var next = parseInt(this.currentPage)+1;
this.toWrite="(第<font color=blue>"+this.currentPage+"</font>/"+this.totalPage+"页 共"+this.recordSize+"条)";
this.toWrite += "&nbsp;首页&nbsp;上一页&nbsp;<a href='"+this.url+"&_pageNo="+next+"'>下一页</a>";
this.toWrite += "&nbsp;<a href='"+this.url+"&_pageNo="+this.totalPage+"'>末页</a>&nbsp;&nbsp;<input id='forwardPage' size='4' value='' style='ime-mode:disabled;'>&nbsp;<input type='button' value=' GO ' class='button' onclick='"+"_OBJ_NAME.fnForward()'>";
}else if(this.totalPage >1 && this.currentPage != this.totalPage)
{
var next = parseInt(this.currentPage)+1;
var previous = parseInt(this.currentPage)-1;
this.toWrite="(第<font color=blue>"+this.currentPage+"</font>/"+this.totalPage+"页 共"+this.recordSize+"条)";
this.toWrite += "&nbsp;<a href='"+this.url+"&_pageNo=1'>首页</a>&nbsp;<a href='"+this.url+"&_pageNo="+previous+"'>上一页</a>&nbsp;";
this.toWrite += "<a href='"+this.url+"&_pageNo="+next+"'>下一页</a>&nbsp;<a href='"+this.url+"&_pageNo="+this.totalPage+"'>末页</a>";
this.toWrite += "&nbsp;<input id='forwardPage' size='4' value='' style='ime-mode:disabled;'>&nbsp;<input type='button' value=' GO ' class='button' onclick='"+"_OBJ_NAME.fnForward()'>";
}else if(this.totalPage>1 && this.currentPage==this.totalPage)
{
var previous = parseInt(this.currentPage)-1;
this.toWrite="(第<font color=blue>"+this.currentPage+"</font>/"+this.totalPage+"页 共"+this.recordSize+"条)";
this.toWrite += "&nbsp;<a href='"+this.url+"&_pageNo=1'>首页</a>&nbsp;<a href='"+this.url+"&_pageNo="+previous+"'>上一页</a>&nbsp;";
this.toWrite += "下一页&nbsp;末页";
this.toWrite += "&nbsp;<input id='forwardPage' size='4' value='' style='ime-mode:disabled;'>&nbsp;<input type='button' value=' GO ' class='button' onclick='"+"_OBJ_NAME.fnForward()'>";
}
document.getElementById('page').innerHTML = this.toWrite;
};

this.init();
// 跳转函数。
this.fnForward = function()
{
var val = document.getElementById('forwardPage').value;
if(!checkNumber(val))
{
alert('请输入数字!');
document.getElementById('forwardPage').select();
return;
}

if(parseInt(val) > this.totalPage)
{
alert('不能超过最大的页数!');
document.getElementById('forwardPage').value = this.totalPage;
return;
}

location.href = this.url +"&_pageNo="+parseInt(val);
};
}

</script>
分享到:
评论
2 楼 dengyin2000 2007-02-13  
看看我这个, 你把数据获得数据,和填充数据的部分自己改掉就行<br/>
<br/>
<div class='code_title'>js 代码</div>
<div class='dp-highlighter'>
<div class='bar'> </div>
<ol class='dp-c' start='1'>
    <li class='alt'><span><span class='keyword'>function</span><span> PostPaginate(pageSize, isCallAllItems, result){  </span></span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (result)  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.result = result;  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.totalNum = 0;               </span><span class='comment'>// all items' length</span><span>  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.pageSize = 5;               </span><span class='comment'>// default value.</span><span>  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.start = 0;                  </span><span class='comment'>// start index of items</span><span>  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.end = 0;                    </span><span class='comment'>// end index of items</span><span>  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.curPage = 0;                </span><span class='comment'>// current page index</span><span>  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.totalPage = 0;              </span><span class='comment'>// all page count</span><span>  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.isCallAllItems = isCallAllItems;  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.init(0, pageSize, result.itemCount);  </span></span></li>
    <li class=''><span>}  </span></li>
    <li class='alt'><span>  </span></li>
    <li class=''><span><span class='comment'>// prepay all need data, ie totalNum, start, end .... also it would do something others,</span><span>  </span></span></li>
    <li class='alt'><span><span class='comment'>// fill the data to html page, controll the first, previous, next, last buttons status.</span><span>  </span></span></li>
    <li class=''><span>PostPaginate.prototype.init=<span class='keyword'>function</span><span>(currentPage, onePageSize, totalNum){  </span></span></li>
    <li class='alt'><span>    window.scroll(0, 0);  </span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.pageSize = onePageSize;  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.totalNum = totalNum;  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.totalPage = Math.ceil(</span><span class='keyword'>this</span><span>.totalNum / </span><span class='keyword'>this</span><span>.pageSize);  </span></span></li>
    <li class='alt'><span>          </span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (currentPage &gt;=0){  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>if</span><span> (currentPage &gt;= Math.ceil(</span><span class='keyword'>this</span><span>.totalNum / </span><span class='keyword'>this</span><span>.pageSize)){  </span></span></li>
    <li class=''><span>            <span class='keyword'>this</span><span>.curPage = </span><span class='keyword'>this</span><span>.totalPage-1;  </span></span></li>
    <li class='alt'><span>        }<span class='keyword'>else</span><span>{  </span></span></li>
    <li class=''><span>            <span class='keyword'>this</span><span>.curPage = currentPage;  </span></span></li>
    <li class='alt'><span>        }  </span></li>
    <li class=''><span>    }<span class='keyword'>else</span><span>{  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>this</span><span>.curPage = 0;  </span></span></li>
    <li class=''><span>    }  </span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.start = </span><span class='keyword'>this</span><span>.curPage * </span><span class='keyword'>this</span><span>.pageSize;  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.end = </span><span class='keyword'>this</span><span>.start + </span><span class='keyword'>this</span><span>.pageSize;  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.end &gt; </span><span class='keyword'>this</span><span>.totalNum){  </span></span></li>
    <li class=''><span>        <span class='keyword'>this</span><span>.end = </span><span class='keyword'>this</span><span>.totalNum;  </span></span></li>
    <li class='alt'><span>    }  </span></li>
    <li class=''><span>  </span></li>
    <li class='alt'><span>      </span></li>
    <li class=''><span>    <span class='comment'>// controll buttons</span><span>  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.controllButtonsStatus();  </span></span></li>
    <li class=''><span>    <span class='comment'>// fill html</span><span>  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.fillDataWithCurrentPageItems();  </span></span></li>
    <li class=''><span>    <span class='comment'>//update the description</span><span>  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.fillPaginateDescription();  </span></span></li>
    <li class=''><span>      </span></li>
    <li class='alt'><span>};  </span></li>
    <li class=''><span>  </span></li>
    <li class='alt'><span><span class='keyword'>function</span><span> callbackGetItemsForPaginate(result, exception){  </span></span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (exception) {  </span></span></li>
    <li class='alt'><span>        showError(<span class='string'>"An error has occurred: "</span><span> + exception.message);  </span></span></li>
    <li class=''><span>    } <span class='keyword'>else</span><span> {  </span></span></li>
    <li class='alt'><span>        <span class='comment'>// escape titles</span><span>  </span></span></li>
    <li class=''><span>        <span class='keyword'>for</span><span> (</span><span class='keyword'>var</span><span> i = 0; i &lt; result.items.length; i++) {  </span></span></li>
    <li class='alt'><span>            <span class='keyword'>var</span><span> item = result.items[i];  </span></span></li>
    <li class=''><span>            <span class='keyword'>if</span><span> (item.categoryInformation) {  </span></span></li>
    <li class='alt'><span>                item.categoryInformation.title = dojo.string.escape(<span class='string'>"html"</span><span>, item.categoryInformation.title);  </span></span></li>
    <li class=''><span>            }  </span></li>
    <li class='alt'><span>        }  </span></li>
    <li class=''><span>        pageinate.result = result;  </span></li>
    <li class='alt'><span>        pageinate.init(pageinate.curPage, pageinate.pageSize, result.itemCount);  </span></li>
    <li class=''><span>    }  </span></li>
    <li class='alt'><span>}  </span></li>
    <li class=''><span>  </span></li>
    <li class='alt'><span>PostPaginate.prototype.fetchData=<span class='keyword'>function</span><span>(curPage){  </span></span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (!checkTreeNodeExisted(selectWhichNode)){  </span></span></li>
    <li class='alt'><span>        alert(<span class='string'>"Sorry, this feed was previously removed from your feed tree."</span><span>);  </span></span></li>
    <li class=''><span>        <span class='keyword'>return</span><span>;  </span></span></li>
    <li class='alt'><span>    }  </span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isCallAllItems){  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>this</span><span>.result = jsonrpc.subscribe.getItems(callbackGetItemsForPaginate, </span><span class='keyword'>true</span><span>, selectWhichNode, selectedTime,</span><span class='keyword'>true</span><span>, curPage, </span><span class='keyword'>false</span><span>, </span><span class='keyword'>this</span><span>.totalNum);  </span></span></li>
    <li class=''><span>    }<span class='keyword'>else</span><span>{  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>this</span><span>.result = jsonrpc.subscribe.getItems(callbackGetItemsForPaginate, </span><span class='keyword'>false</span><span>, selectWhichNode, selectedTime,</span><span class='keyword'>true</span><span>, curPage, </span><span class='keyword'>false</span><span>, </span><span class='keyword'>this</span><span>.totalNum);  </span></span></li>
    <li class=''><span>    }  </span></li>
    <li class='alt'><span>};  </span></li>
    <li class=''><span>  </span></li>
    <li class='alt'><span>PostPaginate.prototype.goFirstPage=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isFirstPage())  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>return</span><span> ;  </span></span></li>
    <li class=''><span>    <span class='keyword'>this</span><span>.fetchData((</span><span class='keyword'>this</span><span>.curPage = 0));  </span></span></li>
    <li class='alt'><span>};  </span></li>
    <li class=''><span>PostPaginate.prototype.goPreviousPage=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isFirstPage())  </span></span></li>
    <li class=''><span>        <span class='keyword'>return</span><span> ;  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>this</span><span>.fetchData((</span><span class='keyword'>this</span><span>.curPage = </span><span class='keyword'>this</span><span>.curPage -1));  </span></span></li>
    <li class=''><span>};  </span></li>
    <li class='alt'><span>PostPaginate.prototype.goNextPage=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isLastPage())  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>return</span><span> ;  </span></span></li>
    <li class=''><span>        <span class='keyword'>this</span><span>.fetchData((</span><span class='keyword'>this</span><span>.curPage = </span><span class='keyword'>this</span><span>.curPage + 1));  </span></span></li>
    <li class='alt'><span>};  </span></li>
    <li class=''><span>PostPaginate.prototype.goLastPage=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isLastPage())  </span></span></li>
    <li class=''><span>        <span class='keyword'>return</span><span>  ;  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>this</span><span>.fetchData((</span><span class='keyword'>this</span><span>.curPage = </span><span class='keyword'>this</span><span>.totalPage - 1));  </span></span></li>
    <li class=''><span>};  </span></li>
    <li class='alt'><span>PostPaginate.prototype.isFirstPage=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>return</span><span> </span><span class='keyword'>this</span><span>.curPage &lt;= 0;  </span></span></li>
    <li class='alt'><span>}  </span></li>
    <li class=''><span>PostPaginate.prototype.isLastPage=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>return</span><span> </span><span class='keyword'>this</span><span>.curPage &gt;= </span><span class='keyword'>this</span><span>.totalPage - 1;  </span></span></li>
    <li class=''><span>}  </span></li>
    <li class='alt'><span>  </span></li>
    <li class=''><span><span class='comment'>// get current page's item data</span><span>  </span></span></li>
    <li class='alt'><span>PostPaginate.prototype.getCurrentPageItems=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>return</span><span> </span><span class='keyword'>this</span><span>.items.slice(</span><span class='keyword'>this</span><span>.start, </span><span class='keyword'>this</span><span>.end);  </span></span></li>
    <li class='alt'><span>};  </span></li>
    <li class=''><span><span class='comment'>// this function is use for fill you html page with current page items</span><span>  </span></span></li>
    <li class='alt'><span>PostPaginate.prototype.fillDataWithCurrentPageItems=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>var</span><span> content = postsTemplate.process({</span><span class='string'>"items"</span><span>:</span><span class='keyword'>this</span><span>.result.items});         </span></span></li>
    <li class='alt'><span>    dojo.byId(<span class='string'>"selection_output"</span><span>).innerHTML = content;  </span></span></li>
    <li class=''><span>    <span class='comment'>// We will those IMG, whose width are larger than 500 px.</span><span>  </span></span></li>
    <li class='alt'><span>    preImgsForAdujstWidth();  </span></li>
    <li class=''><span>};  </span></li>
    <li class='alt'><span>PostPaginate.prototype.controllButtonsStatus=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>var</span><span> buttons = document.getElementsByName(</span><span class='string'>"paginationButtons"</span><span>);  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.totalPage &lt;= 1){  </span></span></li>
    <li class=''><span>        <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0;i&lt;2;i++){  </span></span></li>
    <li class='alt'><span>            buttons[i].style.display = <span class='string'>"none"</span><span>;  </span></span></li>
    <li class=''><span>        }  </span></li>
    <li class='alt'><span>          </span></li>
    <li class=''><span>    }<span class='keyword'>else</span><span>{  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0;i&lt;2;i++){  </span></span></li>
    <li class=''><span>            buttons[i].style.display = <span class='string'>"block"</span><span>;  </span></span></li>
    <li class='alt'><span>        }  </span></li>
    <li class=''><span>        <span class='keyword'>var</span><span> firstButtons = document.getElementsByName(</span><span class='string'>"paginationFirst"</span><span>);  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>var</span><span> previousButtons = document.getElementsByName(</span><span class='string'>"paginationPrevious"</span><span>);  </span></span></li>
    <li class=''><span>        <span class='keyword'>var</span><span> nextButtons = document.getElementsByName(</span><span class='string'>"paginationNext"</span><span>);  </span></span></li>
    <li class='alt'><span>        <span class='keyword'>var</span><span> lastButtons = document.getElementsByName(</span><span class='string'>"paginationLast"</span><span>);  </span></span></li>
    <li class=''><span>          </span></li>
    <li class='alt'><span>        <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isFirstPage()){  </span></span></li>
    <li class=''><span>            <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0;i&lt;2;i++){  </span></span></li>
    <li class='alt'><span>                firstButtons[i].className=<span class='string'>"gray-button"</span><span>;  </span></span></li>
    <li class=''><span>                previousButtons[i].className=<span class='string'>"gray-button"</span><span>;       </span></span></li>
    <li class='alt'><span>            }     </span></li>
    <li class=''><span>        }<span class='keyword'>else</span><span>{  </span></span></li>
    <li class='alt'><span>            <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0;i&lt;2;i++){  </span></span></li>
    <li class=''><span>                firstButtons[i].className=<span class='string'>"red-button"</span><span>;  </span></span></li>
    <li class='alt'><span>                previousButtons[i].className=<span class='string'>"red-button"</span><span>;        </span></span></li>
    <li class=''><span>            }     </span></li>
    <li class='alt'><span>        }  </span></li>
    <li class=''><span>          </span></li>
    <li class='alt'><span>        <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.isLastPage()){  </span></span></li>
    <li class=''><span>            <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0;i&lt;2;i++){  </span></span></li>
    <li class='alt'><span>                nextButtons[i].className=<span class='string'>"gray-button"</span><span>;  </span></span></li>
    <li class=''><span>                lastButtons[i].className=<span class='string'>"gray-button"</span><span>;       </span></span></li>
    <li class='alt'><span>            }  </span></li>
    <li class=''><span>        }<span class='keyword'>else</span><span>{  </span></span></li>
    <li class='alt'><span>            <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0;i&lt;2;i++){  </span></span></li>
    <li class=''><span>                nextButtons[i].className=<span class='string'>"red-button"</span><span>;  </span></span></li>
    <li class='alt'><span>                lastButtons[i].className=<span class='string'>"red-button"</span><span>;    </span></span></li>
    <li class=''><span>            }  </span></li>
    <li class='alt'><span>        }  </span></li>
    <li class=''><span>    }  </span></li>
    <li class='alt'><span>}  </span></li>
    <li class=''><span><span class='comment'>// update the description</span><span>  </span></span></li>
    <li class='alt'><span>PostPaginate.prototype.fillPaginateDescription=<span class='keyword'>function</span><span>(){  </span></span></li>
    <li class=''><span>    <span class='keyword'>var</span><span> textCs = document.getElementsByName(</span><span class='string'>"paginationText"</span><span>);  </span></span></li>
    <li class='alt'><span>    <span class='keyword'>var</span><span> startIndex = 0;  </span></span></li>
    <li class=''><span>    <span class='keyword'>if</span><span> (</span><span class='keyword'>this</span><span>.start &lt;  0)  </span></span></li>
    <li class='alt'><span>        startIndex = 0;  </span></li>
    <li class=''><span>    <span class='keyword'>else</span><span>  </span></span></li>
    <li class='alt'><span>        startIndex = <span class='keyword'>this</span><span>.start + 1;  </span></span></li>
    <li class=''><span>    <span class='keyword'>for</span><span>(</span><span class='keyword'>var</span><span> i=0; i&lt;2; i++){  </span></span></li>
    <li class='alt'><span>        textCs[i].innerHTML=<span class='string'>"Posts &lt;B&gt;"</span><span> + startIndex + </span><span class='string'>"&lt;/B&gt; to &lt;B&gt;"</span><span> + </span><span class='keyword'>this</span><span>.end + </span><span class='string'>"&lt;/B&gt; of &lt;B&gt;"</span><span> + </span><span class='keyword'>this</span><span>.totalNum  + </span><span class='string'>"&lt;/B&gt;"</span><span>;  </span></span></li>
    <li class=''><span>    }  </span></li>
    <li class='alt'><span>}  </span></li>
</ol>
</div>
1 楼 king6860 2007-02-12  
构造函数应该是这样:
function pageObject(url,currentPage,totalPage,recordSize,objName)
{
// 对象名称
this._OBJ_NAME = objName;
// 查询的URL 和QueryString
this.url = url;
// 当前页
this.currentPage = currentPage;
// 共多少页
this.totalPage = totalPage;
// 共多少条记录
this.recordSize = recordSize;
// document.write 的字符串
this.toWrite = "";
.....
}

相关推荐

    简单易懂js分页(已封装)

    JavaScript(简称JS)是一种轻量级的解释型编程语言,广泛应用于网页和网络应用开发,特别是在客户端渲染的应用中。在大型数据展示或者用户交互较多的页面中,分页是一种非常实用的功能,它可以帮助用户逐步加载大量...

    asp分页函数(无错版)

    在标题中提到的“asp分页函数(无错版)”,这通常指的是一个经过优化和测试的分页脚本,能够在不同场景下稳定工作,避免常见的错误。这样的分页函数可能包含了错误处理机制,确保在数据量变化或用户操作异常时也能...

    js实现的异步分页封装

    在JavaScript开发中,异步分页是一种常见的网页交互方式,特别是在大数据量的列表展示中,为了提高用户体验和加载速度,通常会采用分页技术。本文将深入探讨如何使用JavaScript实现异步分页,并进行封装,以便在多个...

    封装的分页插件

    这里提到的是一个由个人开发者封装的简单分页插件,它可以帮助我们轻松地在网页上实现数据的分页显示。 分页的基本原理是将大数据集分割成较小、可管理的部分,通常每一页显示一定数量的条目。这样可以提高用户体验...

    JS基于封装函数实现的表格分页完整示例

    2. **JavaScript函数封装**: 函数封装是将一个或多个功能封装成一个独立的代码块,便于重用。在本示例中,通过封装函数实现分页,比如读取表格数据、分页逻辑处理、数据的遍历和显示等功能。 3. **分页逻辑实现**: ...

    叶子asp分页类0.12

    2.类几个函数的bug修正 0.05Beta: 1.全面代码优化,mysql/sqlite支持 2.参数输入方式修改 0.04Beta: 1.做到调用代码一样适应多种数据库集成分页 2.js去掉了表单,支持静态提交 3.加上了存储过程 0.03Beta: 1.公开...

    js函数扩展

    4. **箭头函数**:箭头函数是ES6引入的新语法,其语法简洁,且没有自己的`this`值,它会从外层作用域继承`this`,这与传统函数不同,解决了`this`指向问题,尤其在回调函数和事件处理中非常有用。 5. **函数组合**...

    js分页的工具

    总的来说,`pagination.js`是一个强大且灵活的JS分页工具,它简化了分页实现过程,使开发者能够更专注于业务逻辑,而非基础UI组件的实现。通过理解其工作原理和提供的配置选项,我们可以快速地为网页添加高效、美观...

    js下通过getList函数实现分页效果的代码.docx

    ### JavaScript 下通过 `getList` 函数实现分页效果的关键知识点 #### 一、分页功能概述 在网页应用中,当数据量较大时,通常不会一次性加载所有数据,而是采用分页的方式展示数据,以此来提升用户体验并减轻服务器...

    VB语言的分页代码,已经写成类

    在本篇内容中,我们将详细介绍如何使用VBScript(Visual Basic Script Edition)来实现一个简单的分页功能,并将其封装成一个易于调用的类。 #### 分页代码概述 提供的代码示例是用VBScript编写的,主要用于ASP...

    Jquery Ajax分页(有实例)

    jQuery,一个轻量级、功能丰富的JavaScript库,结合AJAX(异步JavaScript和XML)技术,可以实现动态、高效的分页效果。本篇文章将深入探讨jQuery AJAX分页的原理与实践,通过具体的实例来展示如何实现炫酷的分页功能...

    漂亮的js分页效果

    综上所述,“漂亮的js分页效果”涉及多个JavaScript和前端开发的关键概念,包括JavaScript基础、DOM操作、事件监听、AJAX请求、CSS样式设计、响应式布局、模块化编程以及用户体验优化等。通过理解并熟练掌握这些知识...

    javascript 分页模块

    7. **类库与插件**:在实际开发中,我们往往使用现有的JavaScript分页库,如`bootstrap-paginator.js`、`pager.js`或本案例中的`Cls_jsPage.js`,这些库封装了上述逻辑,提供更易用的API。 8. **示例代码**:`demo....

    PHP实用分页函数方法

    在实际项目中,可以将这个分页函数封装到一个类中,提供更多的定制选项,如URL模式、分页样式等。结合前端技术,如CSS和JavaScript,可以进一步提升分页的用户体验。 总的来说,PHP分页是数据库驱动的Web应用中常见...

    分页效果自己编写的

    在实际应用中,这些函数会被封装在一个模块或者类中,以实现更好的复用和维护。例如,可以创建一个`Pagination`类,包含上述方法,并在实例化时传入必要的参数如总数据量和每页数量。 HTML部分则负责展示分页栏,...

    nodejs mysql 实现分页的方法

    Node.js结合MySQL实现分页查询是一种常见的数据处理方式,在Web应用中尤为常见。分页可以有效提高页面的响应速度,并优化用户的浏览体验。本文主要介绍了在Node.js环境下,如何使用MySQL数据库实现分页功能。 首先...

    纯js实现分页 可跳转指定页

    通过上述步骤,我们可以构建一个灵活、可自定义的JavaScript分页插件,它不仅能满足基本的分页需求,还能根据用户的交互进行指定页的跳转,同时提供丰富的样式定制选项。在实际开发中,这样的插件可以帮助我们高效地...

    Bootstrap分页组件的设计

    分页组件的使用非常简单,只需要在文档ready事件中调用 `loadData` 函数,用于加载数据和生成分页信息。 关键技术点 * 使用 Bootstrap 框架提供的 pagination 组件来实现分页控件 * 使用 JavaScript 语言来实现...

    封装好的javascript前端分页插件pagination

    **封装好的JavaScript前端分页插件pagination** 在前端开发中,分页是一个常见的需求,尤其在数据量较大的情况下,为了优化用户体验,通常会采用分页显示数据。在众多的前端分页插件中,`pagination` 是一个独立、...

    纯前端分页

    纯前端分页是一种在网页上实现数据展示时的常见技术,尤其在大数据量的情况下,它能够有效地提升用户体验,避免一次性...通过深入研究这些文件,开发者可以更好地掌握纯前端分页的实现方法,并将其应用于自己的项目中。

Global site tag (gtag.js) - Google Analytics