XML data island with paging

Source: Internet
Author: User

The pure client solution is quite practical in the past, and the effect is to load XML without refreshing, including paging. This is the script. The younger brother is dull and takes a lot of time. It's a pity to delete it. Here is a souvenir.

Function loadxml () {<br/> var xdoc = NULL; // browser version <br/> If (document. implementation & document. implementation. createdocument) {<br/> xdoc = document. implementation. createdocument ("", "", null); <br/> // alert ("better experience, please use IE browser. version 5.0 or later. "); <br/> var Req = new XMLHttpRequest (); // make a instance for loading XML files (loacl or remote <br/> req. open ("get", "web_config.xml", false); <br/> r Eq. send (null); <br/> // print the name of the root element or error message <br/> var dom = req. responsexml; <br/> dump(dom.doc umentelement. nodename = "parsererror "? "Error while parsing": dom.doc umentelement. nodename); <br/> new insertion. bottom ('obj _ title', Dom. getelementsbytagname ('title') [0]. firstchild. data); <br/> // alert (Dom. getelementsbytagname ('title') [0]. firstchild. data) <br/> return; <br/>} else if (typeof activexobject! = "Undefined") {<br/> var msxmlax = NULL; <br/> try {msxmlax = new activexobject ("msxml2.domdocument");} <br/> catch (E) {msxmlax = new activexobject ("MSXML. domdocument ") ;}< br/> xdoc = msxmlax; <br/>}< br/> If (xdoc = NULL | typeof xdoc. load = "undefined") {xdoc = NULL ;}< br/> xdoc. async = false; <br/> xdoc. load ("web_config.xml"); <br/> root = xdoc.doc umentelement; <br/>}< br/> // functio N loadxml () {// loadxml 1 = It's ie; <br/> // var xdoc = NULL; // browser version <br/> // If (document. implementation & document. implementation. createdocument) {<br/> // xdoc = document. implementation. createdocument ("", "", null); <br/> // alert ("better experience, please use IE browser. version 5.0 or later. "); <br/> // for FF reading XML <br/> // var Req = new XMLHttpRequest (); // make a instance for loading XML files (loacl or remote <br/>/ /Req. open ("get", "web_config.xml", false); <br/> // req. send (null); <br/> /// print the name of the root element or error message <br/> // var dom = req. responsexml; <br/> // dump(dom.doc umentelement. nodename = "parsererror "? "Error while parsing": dom.doc umentelement. nodename); <br/> // var DDD = Dom. getelementsbytagname ('title') [0]. firstchild. data; <br/> /// alert (Dom. getelementsbytagname ('title') [0]. firstchild. data) <br/> // return (loadxml = false;); <br/> //} else if (typeof activexobject! = "Undefined") {<br/> // var msxmlax = NULL; <br/> // try {msxmlax = new activexobject ("msxml2.domdocument ");} <br/> // catch (e) {msxmlax = new activexobject ("MSXML. domdocument ") ;}< br/> // xdoc = msxmlax; <br/>/}< br/> // If (xdoc = NULL | typeof xdoc. load = "undefined") {xdoc = NULL ;}< br/>/< br/> // xdoc. async = false; <br/> // xdoc. load ("web_config.xml"); <br/> // root = xdoc.doc umentelement; <br/> // return (loadxml = true ); <Br/> //} <br/> function list (PAGE) {<br/> try {<br/> var loading =$ ("loading "); <br/> loading. style. display = "NONE"; <br/> var bigclass = $ ("bigclass"); // There's problem: Select alway over the div... <br/> bigclass. style. display = ""; <br/> var objxml = document. getelementbyid ("detailsdso"); <br/> var rs = objxml. recordset; <br/> Rs. pagesize = 4 // new_pagesize (); // obtain the number of entries displayed on each page <br/> var dd = Objxml. recordset. pagecount; <br/> var rc = Rs. recordcount; <br/> If (page <= dd) {<br/> Rs. absolutepage = page; <br/> var STR = ""; <br/> var J = 0; <br/> while (! (RS. EOF) {<br/> If (j <= (new_pagesize ()-1 )) {<br/> STR = STR + "<Div align =/" Left/"> "; <br/> // STR = STR + "<tr> <TD align =/" Left/">" <br/> STR = STR + " "; <br/> STR = STR + "<a href ="/"mce_href ="/"" page_detail.asp? Id = "+ RS (" ID ") +"/">" + RS ("title") + "</a> "; <br/> STR = STR + "<Div styele =/" margin: 10px;/"> </div> "; <br/> // STR = STR + "</TD> </tr>" str = STR + ("</div> "); <br/>}< br/> J = J + 1; <br/> Rs. movenext; <br/>}< br/> pagepage. innerhtml = STR; <br/> // output paging navigation <br/> var str2 = ""; <br/> var onclickk = "<a href =" ### "mce_href =" ### "onclick = 'list ('"; <br/> for (VAR I = 1; I <= dd; I ++) {<br/> str2 = str2 + "<A href =" ### "mce_href =" ### "onclick = 'list (" + I + "); '> "+ I +" </a> "; <br/>}< br/> s_page.innerhtml = str2; <br/> total_page.innertext = dd; <br/> total_page.title = dd; // Insert the total number of pages <br/> document. getelementbyid ("pageno "). value = page; <br/> var obj_curr_page = document. getelementbyid ("curr_page"); <br/> obj_curr_page.innerhtml = page; <br/> var obj_total_record = document. getelementbyid ("Total _ Record "); <br/> obj_total_record.innerhtml = RC; <br/> loadxml (); // read the configuration file <br/> var news_pagesize = root. selectsinglenode ("// page/new_pagesize "). firstchild. nodevalue; <br/> var obj_news_pagesize = document. getelementbyid ("news_pagesize"); <br/> obj_news_pagesize.innerhtml = news_pagesize; <br/>}< br/> else {<br/> alert ("the data is insufficient, only "+ dd +" page "in total); <br/>}< br/> catch (e) {list1 (1)} <br/>} <Br/> function move_last () {<br/> var obj_total_page = document. getelementbyid ("total_page "). title; <br/> list1 (obj_total_page); <br/>}< br/> function list1 (page) {// buffer design prevents XML data from arriving when the page is loaded <br/> var SSS =$ ("detailsdso"); <br/> // alert (SSS. readystate) <br/> If (SSS. src = "") {SSS. src = xml_file;} // Add the Load file to js control for detection <br/> If (SSS. readystate = "complete") {list (PAGE) ;}< br/> else {<br/> Var loading = $ ("loading"); <br/> var bigclass = $ ("bigclass"); // There's problem: Select alway over the div... <br/> bigclass. style. display = "NONE"; <br/> loading. style. display = "Block"; <br/> effect. pulsate ("loading"); <br/> loading. style. left = math. floor (window. screen. width/3); // center <br/> loading. style. top = math. floor (window. screen. height/3); <br/> // alert (loading. style) <br/> settime ("List (" + Page + ")", 1000 ); // re-loading time varies according to the network speed setting time <br/>}< br/> function _ GOTO () {<br/> If (checknum (document. getelementbyid ("pageno "). value) <br/> {list1 (math. floor (document. getelementbyid ("pageno "). value)} <br/> else {document. getelementbyid ("pageno "). value = 1} <br/>}< br/> function checknum (STR) {return! // D /. test (STR)} // check whether the number is composed. <br/> function new_pagesize () {<br/> loadxml (); <br/> var new_pagesize = root. selectsinglenode ("// page/new_pagesize "). firstchild. nodevalue; <br/> // var obj_new_pagesize = document. getelementbyid ("new_pagesize"); <br/> // response = new_pagesize; <br/> return new_pagesize = new_pagesize; <br/> // alert (new_pagesize ); <br/>}< br/> function contentsize (size )/ /Text font adjustment <br/>{< br/> var OBJ =$ ("main_content"); <br/> obj. style. fontsize = size + "PX"; <br/>}< br/> function ch_dl (selobj, restore) {// reload & re SQL // alert ("S "); // synchronization problem occurs, which can be solved in the buffer <br/> var objxml3 = document. getelementbyid ("detailsdso"); <br/> objxml3.src = xml_file + "? S1 = "+ selobj. options [selobj. selectedindex]. value; <br/> list1 (1); <br/> If (Restore) {selobj. selectedindex = 0 ;}< br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.