XML DOM nodeType ਵਿਸ਼ੇਸ਼ਤਾ
ਵਿਆਖਿਆ ਅਤੇ ਵਰਤੋਂ
nodeType
ਵਿਸ਼ੇਸ਼ਤਾ ਨੂੰ ਨੋਟ ਟਾਈਪ ਵਾਪਸ ਦਿੰਦੀ ਹੈ。
ਵਿਧਾਨ
documentObject.nodeType
ਉਦਾਹਰਣ
ਨਿਮਨਲਿਖਤ ਕੋਡ "books.xml" ਨੂੰ xmlDoc ਵਿੱਚ ਲੋਡ ਕਰੇਗਾ ਅਤੇ ਪ੍ਰੋਟੋਟਾਈਪ ਨੂੰ ਨੋਟ ਨਾਮ ਅਤੇ ਨੋਟ ਟਾਈਪ ਦਿਖਾਵੇਗਾ:
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 + ")"; }