XML DOM nodeValue अट्रिब्यूट
वर्णन और उपयोग
nodeValue
प्रत्येक नोड के मूल्य को सेट करना या लॉड करना, उसके टाइप के अनुसार。
व्याकरण
अट्रॉबजेक्ट.नोडवैल्यू
उदाहरण
नीचे का कोड "books.xml" को xmlDoc में लोड करता है, और category अट्रिब्यूट के नोड नाम, नोड मूल्य और नोड टाइप दिखाता है:
वार xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { यदि (इस.readyState == 4 && इस.status == 200) { माइफ़ंक्शन(इस); } }; xhttp.open("GET", "books.xml", true); xhttp.send(); फ़ंक्शन माइफ़ंक्शन(एक्सएमएल) { वार x, i, xmlDoc, txt; xmlDoc = xml.responseXML; txt = ""; x = xmlDoc.getElementsByTagName('book'); फ़ोर (i = 0; i < x.length; i++) { txt += x.item(i).attributes[0].nodeName + " = " + x.item(i).attributes[0].nodeValue + " (nodetype: " + x.item(i).attributes[0].nodeType + ")" + "<br>"; } document.getElementById("demo").innerHTML = txt; }