IE8 - “为空或不是对象”错误

时间:2013-09-24 14:59:05

标签: javascript internet-explorer-8

我有HTML:

 <td style="vertical-align: bottom;"><div id="resultCount">n.v.</div></td>

JavaScript:

 function processResultCount(data) {
    $("#resultCount").html(formatNumber(data.resultCount, "."));
    $("#resultCount2").html(formatNumber(data.resultCount, "."));
    for (property in data) {
        var value = data[property];
        $("#" + property).html(formatNumber(value, "."));
    }

function formatNumber(nStr, delimiter) {
    nStr += '';
    x = nStr.split('.');
 x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;    
.....
......

在IE8中,我收到错误:“resultCount为null或不是对象”

1 个答案:

答案 0 :(得分:0)

我在这里调用函数processResultCount:

var jsonFormOptions = {
    // dataType identifies the expected content type of the server response
    dataType: 'json',
    // success identifies the function to invoke when the server response
    // has been received
    success: processResultCount(),
    error: handleResultCountError,
    // will be overridden in setupExtSearchFormBindings()
    url: jsonFormUrl,
    type: 'get'
}