SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict MrBaseball34's Avatar
    Join Date
    Sep 2002
    Location
    Round Rock, Texas
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with assigning innerHTML in IE, code works flawlessly in FF

    I have a table that I'm loading via an AJAX call upon selecting an item in a SELECT.

    The code works flawlessly in FF but in IE6, I get an error:
    "Unknown runtime error"

    What do I need to do to make this work in both browsers?

    Code JavaScript:
    function getRoster(){
      if(oXMLHTTP=getXMLHTTP()) {
        // the select that user chooses team
        var theselect          = document.getElementById("tid");
        // hidden form field to hold selected teamid
        var tiid               = document.getElementById("teamid");
        tiid.value             = theselect.value;
     
        // Go get the data
        oXMLHTTP.open('get', 'getroster.php?teamid='        + theselect.value);
        oXMLHTTP.onreadystatechange = AddRosterRows; 
        oXMLHTTP.send(null);
      }
    }
     
    function AddRosterRows(){
      if(oXMLHTTP.readyState == 4){ 
        var response      = oXMLHTTP.responseText;
        var tabBody       = document.getElementById("playertablebody");         
        var response      = oXMLHTTP.responseText;
     
        // Unknown runtime error occurs on next line if IE6.
        tabBody.innerHTML = response; 
     
        // Disable the dropdown only if there was a response
        if (response.length > 0) {
          var theselect          = document.getElementById("tid");
          theselect.disabled     = true;
        }
      }
    }
    The Table:
    Code HTML4Strict:
    <table width="400" border="0" cellpadding="1" cellspacing="0" class="playertable">
      <th class="stheader1" width="300" align="center">Player Name</th>
      <th class="stheader1" width="50" align="center">Jersey</th>
      <th class="stheader1" width="50" align="center">Age</th>
      <tbody id="playertablebody">
      </tbody>
    </table>
    Sample Data returned from getroster.php:
    Code HTML4Strict:
    <tr>
      <td class='player2'>
        <input type="hidden" name="pid[]" value="38"/>
        <input type="hidden" name="name[]" value="Jimmy pitcher"/>Jimmy pitcher
      </td>
      <td class='jersey2'><input type="text" size="3" name="jersey[]"/></td>
      <td class='age2'><input type="hidden" name="age[]" value="12"/>12</td>
    </tr>
    <tr>
      <td class='player1'>
        <input type="hidden" name="pid[]" value="37"/>
        <input type="hidden" name="name[]" value="Super Chicken"/>Super Chicken
      </td>
      <td class='jersey1'><input type="hidden" name="jersey[]" value="00"/>00</td>
      <td class='age1'><input type="hidden" name="age[]" value="9"/>9</td>
    </tr>
    MrBaseball34
    Hook'Em Horns!

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Addict MrBaseball34's Avatar
    Join Date
    Sep 2002
    Location
    Round Rock, Texas
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    F*&$#ing Microsoft When are they going to get with the program and make things work like everyone else?
    MrBaseball34
    Hook'Em Horns!


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
  •