IE8中的未知运行时错误

I'm receiving an "Unknown Runtime" error in IE8.

I have an input field where you enter your zip code, then hit a button that says "Get Quotes" for Shipping Estimates, but when I hit this button in IE8 I get an Unknown Runtime Error. Works fine in Chrome, of course.

This is probably going to be a complicated one.

The error happens on the "targetElem.innerHTML = oResponse.results[0];" line of this code:

DmiAjaxFetch = function(targetId, dsPageName, stdQueryParams, paramVal) {

var oAL = DmiAjaxFetchHelper(dsPageName, stdQueryParams);

oAL.handleResponse = function(sQuery, oResponse) {
    var targetElem = document.getElementById(targetId);
    targetElem.innerHTML = oResponse.results[0];
};

// finally, kick off the request to the handler
oAL.sendQuery(paramVal);
};

I have this script at the top of my page, to show/hide based on a button click. The button is "Get Quotes" - when I click Get Quotes, it takes the ZIP code entered, grabs data for that ZIP Code, then shows the Table. This is the JS to show the table:

<script>
 function toggleTable() {
var lTable = document.getElementById("CartTotalContent");
lTable.style.display = (lTable.style.display == "table") ? "none" : "table";
}
</script>

My JS for obtaining the total of the cart on the page is:

 function populateCartTotalInCartPage() {
  var e = document.getElementsByName("COUNTRY_SHIP")[0].value;
  var t = document.getElementsByName("PostalCode_SHIP")[0].value;
  if (e != " - Select - " && document.getElementById("shipping_method") != null) {
    var n = document.getElementsByName("shipping_method");
    var r;
    for (var i = 0; i < n.length; i++) {
      if (n[i].checked) {
        r = n[i].value
      }
    }
    var s = r;
    DmiAjaxFetch("CartTotalContent", "DmiAjax.aspx", "request=CartTotalContent&country_ship=" + e + "&zip_ship=" + t + "&shipping_method=" + s + "&extra=", rnd())
  }
}

My button code is:

<input type="button" OnClick="populateCartTotalInCartPage();toggleTable();" value="Get Quotes" class="btn btn-orange">

The table I'm looking to show is:

<div class="container">
<div class="pull-right">
    <div class="span4 pull-right">
        <table class="table table-striped table-bordered" id="CartTotalContent">
        <tr>
            <td><span class="extra bold">Sub-Total :</span></td>
            <td><span class="bold">$</span></td>
        </tr>
        </table>
        <a href="checkout.aspx"><input type="submit" value="CheckOut" class="btn btn-orange pull-right"></a>
        <input type="button" value="Continue Shopping" onClick="history.back(-1);" class="btn btn-orange pull-right mr10" style="margin-bottom:10px;">
    </div>
</div>

If you're interested in seeing it in action: Add something to your cart, enter zip code, hit Get Quotes http://rsatestamls.kaliocommerce.com/

I wrote a javascript file that automatically handles these errors and posted it on my blog at http://blog.funelr.com/?p=61 checkout the code there and you will learn how to handle these types of errors.