www.webdeveloper.com
Results 1 to 5 of 5

Thread: My script is causing a memory error in IE!

  1. #1
    Join Date
    Jun 2007
    Posts
    3

    My script is causing a memory error in IE!

    Hello all,

    I'm using AJAX to repopulate a <tbody>. The data is returned in JSON format and the DOM is generated by some JavaScript. Sound straight forward, and it works fine in Firefox, but in IE it causes an error:

    The instruction at "hex memory address" referenced memory at "hex memory address". The memory could not be read.
    Has anyone encountered this? Or see something I'm missing in my code?

    Thanks,
    Ben

    Code:
    function buildContactList(originalRequest) {
    
       var NUMBER_OF_CELLS = 5;
       var tbody;
       var row;
       var programRow;
       var cell;
         document.getElementById("pocs").removeChild(document.getElementById("resultsBody"));
       tbody = document.createElement("<tbody id='resultsBody'>");
       document.getElementById("pocs").appendChild(tbody);
          
       var response = eval("(" + originalRequest.responseText + ")");
       var length = response.length;
       
       if(length == 0) { 
          row = document.createElement("<tr>");
          tbody.appendChild(row);
          cell = document.createElement("<td>");
          row.appendChild(cell);     
          cell.colSpan = NUMBER_OF_CELLS;
          cell.innerHTML = "No data found for the given search criteria, please change the search criteria and try again."; 
          cell = null;
          row = null;
          return;
       }
       
       for(var i = 0; i < length; i++) {
    
          programRow = document.createElement("<tr id='row" + i + "'>");
          tbody.appendChild(programRow);
    
          for(var j = 0; j < NUMBER_OF_CELLS; j++) {
    
             cell = document.createElement("<td>");
             programRow.appendChild(cell);
             cell.innerHTML = response[i][j];
             if(j == 0) 
                cell.style.textAlign = "left"; 
    
             cell = null;
          }
    
          programRow = null;
    
       }
       tbody = null;
    }

  2. #2
    Join Date
    May 2007
    Posts
    39
    tbody = document.createElement("<tbody id='resultsBody'>");
    This shouldn't work even in firefox
    Did you modify the native code?

  3. #3
    Join Date
    Jun 2007
    Posts
    3
    hmmm...that does work in FF for me, but changing it isn't doing anything for this memory error.

    No I haven't modified any of IE's code if that's what you mean.

    BTW, this happens on multiple computers as well.

  4. #4
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

  5. #5
    Join Date
    Jun 2007
    Posts
    3
    oh thanks toicontien, it seems that was the cause.

    I was mainly developing in FF where this isn't a problem. damn that ie.

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles