elektroman
August 3rd, 2007, 10:26 AM
Hi guys
I have to load a file xml from javascript and to put all the content of it into a string to display
I have this code that in IE works but not in mozilla can you help me
if (window.ActiveXObject)
{
//Checking if the browser is IEvar
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("note.xml");
if (xmlDoc.parseError.errorCode != 0)
{
var myError = xmlDoc.parseError;
alert("You have error " + myError.reason);
}
else
{
alert(xmlDoc.xml)
}
}
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("","", null);
xmlDoc.async = false;
xmlDoc.load("note.xml");
result = processor.transformToDocument(xmlDoc);
xmls = new XMLSerializer();
output = xmls.serializeToString(result);
alert(output)
}
I have to load a file xml from javascript and to put all the content of it into a string to display
I have this code that in IE works but not in mozilla can you help me
if (window.ActiveXObject)
{
//Checking if the browser is IEvar
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("note.xml");
if (xmlDoc.parseError.errorCode != 0)
{
var myError = xmlDoc.parseError;
alert("You have error " + myError.reason);
}
else
{
alert(xmlDoc.xml)
}
}
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("","", null);
xmlDoc.async = false;
xmlDoc.load("note.xml");
result = processor.transformToDocument(xmlDoc);
xmls = new XMLSerializer();
output = xmls.serializeToString(result);
alert(output)
}