Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Demo by Roko C.B.</title>
</head>
<body>
 
</body>
</html>
 
function nodeVal(el, tag) {
  return el.getElementsByTagName(tag)[0].childNodes[0].nodeValue;
}
var xmlhttp = window.XMLHttpRequest?
  new XMLHttpRequest():
  new ActiveXObject("Microsoft.XMLHTTP"); /*IE*/
xmlhttp.onreadystatechange = function () {
  if (this.readyState == 4) {
    var XML,
        TXT = this.responseText;
    if (window.DOMParser){
      XML = new DOMParser().parseFromString(TXT,"text/xml");
    }else {
      XML = new ActiveXObject("Microsoft.XMLDOM");
      XML.async = false;
      XML.loadXML(TXT);
    }
 
    var el  = XML.getElementsByTagName("country");
    var html = "<table border='1'>";
    for(var i=0; i<el.length; i++){
     html += "<tr><td>"+ nodeVal(el[i], "name") +"</td>"+
                 "<td>"+ nodeVal(el[i],"users") +"</td></tr>";
    }
    html += "</table>";
    document.body.innerHTML = html; 
  }
};
xmlhttp.open("GET", "luwos/1/js/", false);
xmlhttp.send();
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
roXonpro
0viewers