sosuke
03-16-2005, 05:56 PM
Arg, this works perfectly in Firefox, but in Internet Explorer it errors out as "Object Required" in this line:
build = x[0].childNodes[3].childNodes[1].childNodes[1].firstChild.nodeValue;
<script>
function importXML()
{
if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = getBuild;
}
else if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4) getBuild()
};
}
else
{
alert('Your browser can\'t handle this script');
return;
}
xmlDoc.load("/SystemService/getSystemInfo");
}
function getBuild()
{
var x = xmlDoc.getElementsByTagName('Something');
build = x[0].childNodes[3].childNodes[1].childNodes[1].firstChild.nodeValue;
build = build.slice(6, 10);
var newEl = document.createTextNode(build);
document.getElementById('build').appendChild(newEl);
var x = xmlDoc.getElementsByTagName('SomethingElse');
hostname = x[0].childNodes[3].firstChild.nodeValue;
var newEl = document.createTextNode(hostname);
document.getElementById('hostname').appendChild(newEl);
}
</script>Can someone help me figure out whats going wrong here? Thanks! :thumbsup:
build = x[0].childNodes[3].childNodes[1].childNodes[1].firstChild.nodeValue;
<script>
function importXML()
{
if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = getBuild;
}
else if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4) getBuild()
};
}
else
{
alert('Your browser can\'t handle this script');
return;
}
xmlDoc.load("/SystemService/getSystemInfo");
}
function getBuild()
{
var x = xmlDoc.getElementsByTagName('Something');
build = x[0].childNodes[3].childNodes[1].childNodes[1].firstChild.nodeValue;
build = build.slice(6, 10);
var newEl = document.createTextNode(build);
document.getElementById('build').appendChild(newEl);
var x = xmlDoc.getElementsByTagName('SomethingElse');
hostname = x[0].childNodes[3].firstChild.nodeValue;
var newEl = document.createTextNode(hostname);
document.getElementById('hostname').appendChild(newEl);
}
</script>Can someone help me figure out whats going wrong here? Thanks! :thumbsup: