XML DOM nodeType Attribute
Definition and Usage
nodeType
Ang attribute ay ibibigay ang uri ng node type.
Syntax
nodeObject.nodeType
Sample
Ang mga sumusunod na kodigo ay maglalaad ng "books.xml" sa xmlDoc at ipakita ang pangalan at uri ng pangunahing node:
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "books.xml", true); xhttp.send(); function myFunction(xml) { var xmlDoc = xml.responseXML; document.getElementById("demo").innerHTML = "Nodename: " + xmlDoc.nodeName + " (nodetype: " + xmlDoc.nodeType + ")"; }