Code:
<?xml version="1.0" encoding="UTF-8"?>
<Students>
<Student id="1">
<Name>Peter</Name>
</Student>
<Student id="2">
<Name>Paker</Name>
</Student>
<lang>
<Student id="1">
<Name>java</Name>
</Student>
<Student id="2">
<Name>vb</Name>
</Student>
</lang>
</Students>
XML FILE
Code:
if (xmlhttp.readyState == 4 ) {
xmldoc = xmlhttp.responseXML;
if ( xmlhttp.status == 200 ){
students = xmldoc.getElementsByTagName("lang");
student = students[0].childNodes;
for (;i<student.length;i+=cnt){
result += student[i].nodeName + "=" + student[i].firstChild.data+"<br />";
}
obj.innerHTML = result;
}
}
javascript
If I use these code, I can just get:
Student=
Student=
How can I get java and vb in the for loop? thx