function createRequest() {
try {
request = new XMLHttpRequest();
} catch (tryMS) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (otherMS) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
}
}
}
return request;
}
function tester() {
request = createRequest();
if (request == null)
alert("Unable to create request");
else {
var url = "test.leaf";
request.onreadystatechange = showTable;
request.open("GET", url, true);
request.send(null);
}
}
function showTable() {
if (request.readyState == 4) {
if (request.status == 200) {
var xml_content = request.responseXML;
var root_Node = xml_content.getElementsByTagName("Member");
var child_Node_id = xml_content.getElementsByTagName("id");
var child_Node_pass = xml_content.getElementsByTagName("pass");
var result_content = "";
for ( var i = 0; i < root_Node.length; i++) {
id = child_Node_id[i].childNodes[0].nodeValue;
pass = child_Node_pass[i].childNodes[0].nodeValue;
result_content = result_content + id + " : " + pass
+ "
";
}
document.getElementById("content").innerHTML = result_content;
}
}
}