XML Applications
This chapter demonstrates some small XML applications built using XML, HTML, XML DOM, and JavaScript.
XML Document Example
In this application, we will use the "cd_catalog.xml" file.
Display the First CD in an HTML div Element
The following example retrieves XML data from the first CD element and displays it in the HTML element with id="showCD". The displayCD() function is called when the page loads:
Example
Add Navigation Scripts
To add navigation to the above example, you need to create the next() and previous() functions:
Example
Display Album Information When Clicking on a CD
The final example shows how to display album information when a user clicks on a CD item:
For more information on using JavaScript and XML DOM, please visit our XML DOM Tutorial.