Home > Web Front-end > JS Tutorial > Write dynamically generated xml under ExtJS (compatible with Firefox)_extjs

Write dynamically generated xml under ExtJS (compatible with Firefox)_extjs

WBOY
Release: 2016-05-16 17:38:34
Original
1576 people have browsed it
Copy code The code is as follows:

function getXml() {
//Get the input value
var name = textName.getValue();
var pwd = textPwd.getValue();
//Initialization object
var xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.async="false";//Cancel the action of submitting xml before the data is completely filled in

//Xml header writing
var header=xmlDoc.createProcessingInstruction("xml ","version='1.0'");
xmlDoc.appendChild(header);

//Create subtree
var root = xmlDoc.createElement("loginInfo");
var username = xmlDoc.createElement("userName");
var userpassword = xmlDoc.createElement("passWord");
//Create subtree text content
var usernameText=xmlDoc.createTextNode(name);
var passwordText=xmlDoc.createTextNode(pwd);


//Subtree text content mounting
username.appendChild(usernameText);
userpassword.appendChild(passwordText);

//Subtree node mounting
root.appendChild(username);
root.appendChild(userpassword);

//Root content mounting
xmlDoc. appendChild(root);

//Return xml text content
return xmlDoc;
};

I use
Copy code The code is as follows:

var dom= new ActiveXObject()

Only IE can run it. For compatibility, Firefox users must be considered, so this program is for: compatibility for Firefox users; it can be dynamically generated without local XML
Write dynamically generated xml under ExtJS (compatible with Firefox)_extjs
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template