srf

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About srf

  • Rank
    Newbie
  1. Thanks for useful advice. I've looked into sort() and has actually (and finally) managed to get my script running by adding these lines where the values of the tag "id" are parsed in an array and sorted: function sorting(a,b){ return parseInt(a.getElementsByTagName("id")[0].firstChild.nodeValue) - parseInt(b.getElementsByTagName("id")[0].firstChild.nodeValue); } sItems = Array.prototype.slice.call(itm); sItems = sItems.sort(sorting); I’d like to offer the possibility of sorting alphabetically, by “title” as well, but I simply can’t find out what the code should be changed into. Could somebody help, please?
  2. I'm looking for a way to display the contents of an XML file on a web page with AJAX. I rely on the w3schools "simple CD catalog application", which shows a part of the XML (author and title) and, when you click on a title, displays the details of the CD. I need, however, to be able to add sorting and filtering when displaying artist and title - it could, for instance, be sorting the titles alphabetically or apply a filter based on the year of release. XSLT doesn't seem to work with AJAX so I hope JavaScript could be the answer: Is it possible to add such functions to the application example using JavaScript - and how could it be done? I'd really be glad if someone could help.