I am using DOM to view XML in an HTML form. I need some help constructing a loop to allow user to click "Next" button, to view next XML node. I am trying to use the variable "A" to control the array position. I want to create a loop that adds 1 to the value of A each time the button is clicked.
Please help me understand how to break after 1 is added to "A", and how to continue the loop each time the button is clicked.
PrintNode = xmldoc.childNodes[2].selectNodes('./Print');
var A = 0
function NextNode(){
for ( var A = 0; A < 100; A++)
{
document.getElementById("printid").value = PrintNode[A].childNodes[0].text
}
}
Sample XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Printlist.xsl"?>
<PrintList>
<Print>
<ID>001000</ID>
<PrintName>Spring Garden</PrintName>
<Season>spring</Season>
<PrintSize>5x9</PrintSize>
<file href="springgarden.jpg"/>
<Desc></Desc>
</Print>
</PrintList>
Please help me understand how to break after 1 is added to "A", and how to continue the loop each time the button is clicked.
PrintNode = xmldoc.childNodes[2].selectNodes('./Print');
var A = 0
function NextNode(){
for ( var A = 0; A < 100; A++)
{
document.getElementById("printid").value = PrintNode[A].childNodes[0].text
}
}
Sample XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Printlist.xsl"?>
<PrintList>
<Print>
<ID>001000</ID>
<PrintName>Spring Garden</PrintName>
<Season>spring</Season>
<PrintSize>5x9</PrintSize>
<file href="springgarden.jpg"/>
<Desc></Desc>
</Print>
</PrintList>