Expand|Select|Wrap|Line Numbers
- <?xml version="1.0"?>
- <propertyfolio>
- <property_group description="abc">
- <property ref="1" name="One">
- <unit id="2147365895" />
- <units>
- <unit property_ref="1" ref="1" description="description of One" strung_address="Address One" />
- <unit property_ref="1" ref="2" description="description of Two" strung_address="Address Two" />
- <unit property_ref="1" ref="3" description="description of Three" strung_address="Address Three" />
- <unit property_ref="1" ref="4" description="description of Four" strung_address="Address Four" />
- </units>
- </property>
- <property ref="2" name="Two">
- <unit id="37365895" />
- <units>
- <unit property_ref="2" ref="1" description="description of New One" strung_address="New Address One" />
- <unit property_ref="2" ref="2" description="description of New Two" strung_address="New Address Two" />
- </units>
- </property>
- </property_group>
- <property_group description="abc">
- <property ref="2001" name="Two TH One">
- <unit id="1137365895" />
- <units>
- <unit property_ref="2001" ref="1" description="description of Two TH One" strung_address="Address Two TH One" />
- <unit property_ref="2001" ref="2" description="description of Two TH Two" strung_address="Address Two TH Two" />
- </units>
- </property>
- </property_group>
- </propertyfolio>
Expand|Select|Wrap|Line Numbers
- var xmlDoc;
- if (window.ActiveXObject)
- {
- xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
- }
- else if (document.implementation.createDocument)
- {
- xmlDoc=document.implementation.createDocument("","",null);
- }
- else
- {
- alert('Your browser cannot handle this script');
- }
- xmlDoc.async=false;
- xmlDoc.load("propertyfolio.xml");
- x=xmlDoc.getElementsByTagName("property");
- i=0;
- function next()
- {
- if (i<x.length)
- {
- i++;
- display();
- }
- }
- function previous()
- {
- if (i>0)
- {
- i--;
- display();
- }
- }
- function display()
- {
- if (i<x.length)
- {
- address=x.item(i).attributes.getNamedItem("strung_address");
- document.getElementById("show").innerHTML="Address: "+ address.value;
- }
- else i--;
- }
Now I want to work the same navigation with units of a particular property say one we match the property_ref = 2 from XML, all the unit in that property are displayed with the same next and previous button.
Can anyone help me with it.