2014-03-04 52 views
0

这两个函数似乎只能在IE上运行。这是代码:为什么我的代码无法在Chrome或FF中工作

function onGridMembers(id,xml) { 
    if (xml != "<Members/>" && ToHelpOrNotToHelp) { 
     var domDoc = new ActiveXObject("Microsoft.XMLDOM"); 
     domDoc.loadXML(xml); 
     var helpHtml2 = ""; 
     var xmlhttp = new XMLHttpRequest(); 
     xmlhttp.open("GET", "Dictionary.xml", true); 
     xmlDictionary = xmlhttp.responseXML; 
     xmlhttp.send();  
     helpHtml2 += xmlDictionary.selectSingleNode("Terms/Term[Key='" + domDoc.selectSingleNode("Members/Member/@UName").text + "']/Desc").text; 
     alert(helpHtml2);   
    } 
} 



function onCommandClicked(nectoId, commandId, commnadCaption, xml) { 

    if (commandId == "ID223") {    // this one doesn't work in chrome 
     window.open('file://server/Guide.docx'); 
    } else if (commandId == "ID225") {   // This one works in chrome 
     window.open('http://server/Reports/Pages/Folder.aspx');       
    } else if (commandId == "ID227") {  // this one doesn't work in chrome 
     getComponentById("vvv","ww").setMenuItemState("ID227", "Hidden"); 
     getComponentById("vvv","ww").setMenuItemState("ID226", "Enable"); 

     ToHelpOrNotToHelp = false;   
    } else if (commandId == "ID226") {  // this one doesn't work in chrome 
     getComponentById("vvv","ww").setMenuItemState("ID226", "Hidden"); 
     getComponentById("vvv","ww").setMenuItemState("ID227", "Enable"); 

     ToHelpOrNotToHelp = true; 
    } 
} 

你能帮忙吗?

+1

使用仅限IE的ActiveX对象(如'Microsoft.'进一步暗示的),奇怪它为什么不能在IE之外工作... –

+0

https://developer.mozilla.org/zh-CN/docs/ Parsing_and_serializing_XML – CBroe

回答

0

我不确定第二个代码,但第一个代码不能在IE浏览器中工作,因为您使用的是仅限MS的ActiveX。

Firefox错误控制台通常会提供有关JS为什么不起作用的有用信息。

相关问题