Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    66
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unknown runtime error

    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:

    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
    Chris Holbrook
    Freelance Designer and Musician
    Freelance Web Designer and Musician: Bristol, UK
    Visit my site: http://www.chrisholbrook.com

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Don't mix DOM methods with non-standard methods (innerHTML)
    if para returns a text:
    Code:
    ...
    para.className = "success";
    para.appendChild(document.createTextNode(xmlHttp.responseText);			
    document.getElementById(elementId).appendChild(para); 
    ...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Mar 2006
    Posts
    66
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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
    Chris Holbrook
    Freelance Designer and Musician
    Freelance Web Designer and Musician: Bristol, UK
    Visit my site: http://www.chrisholbrook.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •