介绍
这篇文章给大家分享的是有关Xml_javascript分页的代码示例的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
<强> Xml_javascript分页强>
& lt; ! DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0,过渡//EN" ,“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"比; & lt; html  xmlns=癶ttp://www.w3.org/1999/xhtml",在 & lt; head> ,,,& lt; title>龙的传人——Xml_javascript分页& lt;/title> ,,,, & lt;/head> & lt; body  onload=癵etxmlDoc()“比; & lt; script 语言=癑avascript",类型=拔谋?Javascript"比; xmlDoc var ; var nodeIndex; var pageIndex; var 页大?13; var lastPage;,,,//最后一页 var overSize ,,,//最后一页的记录数 function getxmlDoc () { xmlDoc才能=new ActiveXObject (“Microsoft.XMLDOM"); ,,,var currNode; ,,,xmlDoc.async=false; ,,,xmlDoc.load (“myTest.xml"); ,,,如果(xmlDoc.parseError.errorCode !=0) ,,,{ ,,,,,,,var myErr=xmlDoc.parseError; ,,,,,,,警报(“出错!“+ myErr.reason); ,,,} ,,,getRecordCount (); ,,,onFirst (); ,,,, } function getRecordCount () { ,,,var personNode=, xmlDoc.selectNodes (“/Root") [0]; ,,,var recordCount=personNode.childNodes.length; ,,,var pageCount=Math.ceil (recordCount/页大小); ,,,. getelementbyid (“txtPageCount") value=https://www.yisu.com/zixun/pageCount; . getelementbyid (txtRecordCount) value=recordCount; 超大=recordCount %页大小; 如果(超大> 0) { lastPage=recordCount-overSize; } 其他的 { lastPage=recordCount-pageSize; } } 函数getPageRecord (pageIndex页大小) { clearRow (“myTable”); var personNode=xmlDoc.selectNodes(/根)[0]; var currNode=personNode.childNodes [pageIndex]; 我(var=pageIndex;0) { getPageRecord (lastPage,超大的) . getelementbyid (txtCurrPageRecord) value=超大的; } 其他的 { getPageRecord (lastPage页大小) . getelementbyid (txtCurrPageRecord) value=页大小; } pageIndex=lastPage; . getelementbyid (“txtCurrPage”)。值=(pageIndex/页大小)+ 1; } toPage()函数 { var指数=. getelementbyid (txtCurrPage) value var currIndex=(索引1)*页大小; 如果(event.keyCode==13) { getPageRecord (currIndex页大小); } pageIndex=currIndex; } 函数addRow(我dataGridId arr) { var=document.createElement行(tr); var=createCellWidthText细胞(我); row.appendChild(细胞); (var j=0; Xml_javascript分页的代码示例