Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine current page in an XML-bound table? 1

Status
Not open for further replies.

AmazingGrace

Programmer
Sep 9, 2003
23
US
Hi,

First: Here is the html I'm working with:
Code:
<XML ID="Apps" src="Apps.xml"></XML>
<center>
   <table datasrc="#Apps" datapagesize="5" id="tbl">
   <thead>
      <td>Department</td>
      <td>Document Name</td>
      <td>Status</td>
   </thead>
   <tr>
      <td><div datafld="name"></div></td>
      <td><div datafld="title"></div></td>
      <td><div datafld="status"></div></td>
   </tr>
</table>
<!-- Now I add buttons to change pages in the table -->

<input type="button" id="first" value="First" onclick="tbl.firstPage();UpdateBtns();">

<input type="button" id="prev" value="Previous" onclick="tbl.previousPage();UpdateBtns();">

<input type="button" id="next" value="Next" onclick="tbl.nextPage();UpdateBtns();">

<input type="button" id="last" value="Last" onclick="tbl.lastPage();UpdateBtns();">

I've not been successful in determining the current page displayed in the XML-bounded table from in a javascript function. My goal is to enable/disable the four <INPUT> buttons based on the current page state. How can I determine this from a function, like in the UpdateBtns() call I put in the onClick event. For now it is just an empty function.

Any guidance is very much appreciated! I'm new DHTML so please understand I am quite very ignorant in this area.
 
Hello AmazingGrace,

In your event handler, you could retrieve the collection of XML tag elements and discover their src attributes. Something like this
Code:
var cxml=document.all.tags("XML");
if (cxml!=null) {
    for (i=0;i<cxml.length;i++) {
        alert(cxml[i].src);
    }
}
I just alert it, you get the idea. If you want to filter out unique xml tag, you can use cxml.id to discover it. After getting the handle of the object, you change its src attributes.

regards - tsuji
 
Thanks, tsuji

That's just what I needed. Sorry it took so long for me to folloup up on the post... people wanting everything done yesterday around hear.. you know how it goes ;)

Take care, buddy, and thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top