Here is a question about manipulating a document object with javascript:
To access the value of an attribute in an XML document via javascript in a seperate html document, I can retrieve the attribute using the W3C XML DOM -
The XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<notes xmlns:xlink="
<stuff classed="working">
</stuff>
</notes>
The javascript looks like this:
function getAtt()
{
var el;
var strOutput = "";
el = dataXML.documentElement.getElementsByTagName("stuff");
//dataXML is a reference to the XML document object
strOutput = el[0].attributes.getNamedItem("classed").value;
document.getElementById("here").innerHTML = strOutput;
//to display the attribute value in the html document
}
What I would like to know is if it is possible to change the value of that attribute in the XML document object using javascript in my html page? Can I use the replaceChild(newChild, oldChild) method of the Node object, or something similar? So far I have not managed to achieve this.
Is the attribute "classed" a child of the "stuff" element?
To access the value of an attribute in an XML document via javascript in a seperate html document, I can retrieve the attribute using the W3C XML DOM -
The XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<notes xmlns:xlink="
<stuff classed="working">
</stuff>
</notes>
The javascript looks like this:
function getAtt()
{
var el;
var strOutput = "";
el = dataXML.documentElement.getElementsByTagName("stuff");
//dataXML is a reference to the XML document object
strOutput = el[0].attributes.getNamedItem("classed").value;
document.getElementById("here").innerHTML = strOutput;
//to display the attribute value in the html document
}
What I would like to know is if it is possible to change the value of that attribute in the XML document object using javascript in my html page? Can I use the replaceChild(newChild, oldChild) method of the Node object, or something similar? So far I have not managed to achieve this.
Is the attribute "classed" a child of the "stuff" element?