Here is the xml fi开发者_JS百科le I want to modify -
Note: Sorry somehow I cannot type '<'
<nsml version="-//iNEWS//DTD NSML 2.0//EN">
<head> meta wire=o words=347 rate=175> rgroup number=214> wgroup number=214>
<fields>
<f id=title> Title /f>
<f id=headline> Headline /f>
<f id=summary >Summary /f>
</fields>
Here is my JavaScript code -
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new xmlHttpRequest();
}
catch(e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlHttp.open("GET","test.xml",false);
xmlHttp.send();
xmlDoc=xmlHttp.responseXML;
x=xmlDoc.getElementsByTagName("f")[0].childNodes[0]; /*says x is null or not an object */
x.nodeValue="New Title";
Thanks for your help!
You can't modify files only with javascript. Even if you can... why would you do it?
精彩评论