chrisbeach
06-10-2005, 04:28 PM
I've got a chunk of javascript that's giving me grief on IE though it works on Firefox (so what's new eh...?). The error I get from IE is "No such interface supported", the offending code (with the error line in bold) is:
var elToUpdate = document.getElementById(id);
var currentChildren = elToUpdate.childNodes;
while (currentChildren.length > 0)
{
elToUpdate.removeChild(currentChildren[0]);
}
var newChildren = changes[i].getElementsByTagName("content")[0].childNodes;
while (newChildren.length > 0)
{
elToUpdate.appendChild(newChildren[0]);
}
The aim is obviously to replace the current contents of the div with the supplied elements.
Two things to note:
1. the element being updated in this case is a div.
2. the newChildren var is an XML DOM from an XMLHttpRequest response.
I haven't found anyone else complaining about this, which usually means I'm doing something blindingly stupid. Feel free to tell me so, I'd really appreciate any help! :o
var elToUpdate = document.getElementById(id);
var currentChildren = elToUpdate.childNodes;
while (currentChildren.length > 0)
{
elToUpdate.removeChild(currentChildren[0]);
}
var newChildren = changes[i].getElementsByTagName("content")[0].childNodes;
while (newChildren.length > 0)
{
elToUpdate.appendChild(newChildren[0]);
}
The aim is obviously to replace the current contents of the div with the supplied elements.
Two things to note:
1. the element being updated in this case is a div.
2. the newChildren var is an XML DOM from an XMLHttpRequest response.
I haven't found anyone else complaining about this, which usually means I'm doing something blindingly stupid. Feel free to tell me so, I'd really appreciate any help! :o