Results 1 to 5 of 5

Thread: innerHTML problem (Javascript AJAX IE 8)

  1. #1
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default innerHTML problem (Javascript AJAX IE 8)

    I have been stuck on this for 2 days, my code works fine in Firefox and IE7 but in IE 8 it just crashes the browser.

    The function is called via an onkeyup event on a text box. The URL brings back HTML which is passed into a DIV element called "branchresults". I have a feeling its something to do with innerHTML.

    PHP Code:
    function getBranches() {
        
            var 
    clientID document.getElementById("dropClients").value;
            var 
    branchNum document.getElementById("txtBranchNum").value;
            if(
    clientID==""){
                
    alert("Please select a Client ");    
                return 
    false
                
            
    }

            var 
    strURL="ajaxgetbranches.php?client="+clientID+"&branch="+branchNum;
            var 
    req getXMLHTTP();
            
            if (
    req) {
                
                
    req.onreadystatechange = function() { 
                    if (
    req.readyState == 4) {
                        
                        if (
    req.status == 200) {
                                
                            
    rtnHTML=req.responseText;
                            
    //branchresults is a div element
                                  
    document.getElementById("branchresults").innerHTML rtnHTML;
                                            
                        } else {
                            
    alert("There was a problem while using XMLHTTP:\n" req.statusText);
                        }
                        
    req.open("GET"strURLtrue);
                        
    req.send(null);

                    }                
                }            
                
    req.open("GET"strURLtrue);
                
    req.send(null);
            }        
        } 
    Last edited by Abid; 08-19-2009 at 11:21 AM.

  2. #2
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Can anyone help me with this?

  3. #3
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have fixed the problem how silly of me I had this line in twice:

    req.open("GET", strURL, true);
    req.send(null);

  4. #4
    Join Date
    May 2008
    Posts
    144
    Thanks
    6
    Thanked 11 Times in 11 Posts

    Default

    can i see all of your code?

  5. #5
    Join Date
    Jun 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default IE innerHTML problem

    I am just seraching around for 2 days about the innerHTML issue in IE. and found out that the HTML content assigned to innerHTML property having the problem.As html the content containg table layout causing the problem.

    I replaced table layout with div layout and it is working fine on IE.

Bookmarks

Posting Permissions

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