function test()
{
xmlDoc = null;
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc = document.implementation.createDocument("", "", null);
}
catch (e)
{
try //Internet Explorer
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
}
catch (e)
{
alert(e.message);
}
}
xmlDoc.loadXML(xmltest); //假设xmltest是已经有值的了。并且它的值肯定是没有错误的。
}
xmlDoc.loadXML(xmltest);这句,好像只有IE支持loadXML方法,现在要在safari上面实现怎么办呢?
------解决方案--------------------------------------------------------
建议lz采用
- JScript code
var xhr = window.XMLHttpRequest ? new window.XMLHttpRequest(): new window.ActiveXObject("Microsoft.XMLHTTP")xhr.onreadystatechange = function(){ if(xhr.readyState == 4){ var xmlDoc = xhr.responseXML // do something what you want ... }};xhr.open('GET', 'test.xml', true);xhr.send();