当前位置: 代码迷 >> ASP.NET >> 请教:FF的javascript有关问题 var oXmlFiles = new ActiveXObject("Microsoft.XmlDom")
  详细解决方案

请教:FF的javascript有关问题 var oXmlFiles = new ActiveXObject("Microsoft.XmlDom")

热度:9879   发布时间:2013-02-25 00:00:00.0
请问:FF的javascript问题 var oXmlFiles = new ActiveXObject("Microsoft.XmlDom")
1.
  var   oXmlFiles   =   new   ActiveXObject( "Microsoft.XmlDom ")
在ff下怎么写?


------解决方案--------------------------------------------------------
Server.CreateObject( "Microsoft.XMLDOM ")
------解决方案--------------------------------------------------------
try:

var xmlDoc=document.implementation.createDocument( " ", " ",null);
xmlDoc.load( "1.xml ");
------解决方案--------------------------------------------------------
// cross browser
// simple demo
//
function CreateXmlDocByUrl(url, onload)
{
var xmlDoc;
try {
xmlDoc = document.implementation.CreateDocument( " ", " ", null);
if (onload) {
xmlDoc.async = true; // 异步加载
xmlDoc.onload = function () {
onload(xmlDoc);
}
} else {
xmlDoc.async = false;
}
} catch(e) {
try {
xmlDoc = new ActiveXObject( "MSXML2.DOMDocument.3.0 ");
xmlDoc.resolveExternals = true;
if(onload) {
xmlDoc.async = true;
xmlDoc.onreadystatechange = function() {
onload(xmlDoc);
}
} else {
xmlDoc.async = false;
}
}
catch (e) {
throw new Error( "not support to create a document. ");
}
}

// begin load
xmlDoc.load(url);

return xmlDoc;
}
  相关解决方案