PDA

View Full Version : Unknown runtime error


latemodern
10-22-2007, 04:32 PM
Hi,

This is driving me nuts. I am getting an error in ie7 which simply says 'unknown runtime error'. I have boiled it down to the line 'para.innerHTML = xmlHttp.responseText;' in the following code:


function stateChangedAppend(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
para = document.createElement("p");
para.className = "success";
para.innerHTML = xmlHttp.responseText;
document.getElementById(elementId).appendChild(para);
ajaxifyCourses();
}else if(xmlHttp.readyState < 4){
//alert(xmlHttp.status);
//document.getElementById(elementId).innerHTML= '<p class="success">Loading. Please wait</p>';
} else {

}
}


Can anybody suggest what might be making ie7 spit its dummy?

I wish that hell existed so that bill gates could go to it.

Thanks

Kor
10-25-2007, 10:49 AM
Don't mix DOM methods with non-standard methods (innerHTML)
if para returns a text:

...
para.className = "success";
para.appendChild(document.createTextNode(xmlHttp.responseText);
document.getElementById(elementId).appendChild(para);
...

latemodern
10-25-2007, 10:59 AM
Thanks Kor,

The problem is that my server side script is returning a chunk of text and HTML markup. Is there a DOM friendly way of inserting this so that it recognises the tags as HTML and not text?

It took ages for a reply (was it the Bill Gates comment?) so I hacked at it myself and got it to work by using innerHTML with a <span> and then appending that to the paragraph.

Thanks for your help

Chris