以下是场景: 我试图在函数B中读取的xmlDoc是全局声明的。
function main()
{
...
A(input xml);
...
B(other inputs);
}
function A(XML_input)
{
...
var xmlDoc = FLEXWIN.GetData.dsoValidator1Resp.XMLDocument;
xmlDoc.async = false;
xmlDoc.loadXML(XML_input.xml);
}
function B(some other input)
{
// I want to use the xmlDoc.xml here.. But its content is blank.
}
答案 0 :(得分:0)
function main() {
var xmlDoc = A(input_xml);
B(xmlDoc, other_inputs);
}
function A(XML_input) {
var xmlDoc = FLEXWIN.GetData.dsoValidator1Resp.XMLDocument;
xmlDoc.async = false;
xmlDoc.loadXML(XML_input.xml);
return xmlDoc;
}
function B(xmlDoc, other_input) {
//Etc.
}