The location field modification in XML, read [original]

xiaoxiao2021-03-06  63

Function Savefile (filename, xmlstr) // Save text file {var FSO, TF, F; fso = new activXObject ("scripting.filesystemObject"); try {f = fso.getfile (filename); f.attributes = 0;} Catch (e) {} tf = fso.createtextfile (filename, true);

Tf.write (Xmlstr); tf.close ();

Function createdom (xmlstr) {var DOM = New ActiveXObject ("msxml2.domdocument.3.0"); // Create a DOM instance, and load file Dom.Assync = "false"; DOM.LoadXML (Xmlstr); return Dom;}

function setValueByName (pTagName, pKeyName, pValue) {var xmlDom = createDom (openFile (GetXmlFilePath ())); var pNodeList = xmlDom.getElementsByTagName (pTagName); var pchildNode = pNodeList.item (0) .firstChild; for (j = 1 ;; j ) {if (pchildNode.nodeName == pKeyName) {pchildNode.text = pValue; break;} pchildNode = pchildNode.nextSibling;} var xmlStr = xmlDom.xml; xmlStr = xmlStr.replace ( " "), Xmlstr); PTAGNAME, PKEYNAME (PTAGNAME, PKEYNAME)} xmlDom = createDom (openFile (GetXmlFilePath ())); var pNodeList = xmlDom.getElementsByTagName (pTagName); var pchildNode = pNodeList.item (0) .firstChild; var pValue = 100; for (j = 1 ;; j ) {if (pchildnode.nodeename == pKeyname) {pValue = pchildnode.text; return pchildnode = pchildnode.nextsibling;}}

转载请注明原文地址:https://www.9cbs.com/read-111154.html

New Post(0)