2013-09-24 114 views
0

我有HTML:IE8 - “为空或不是对象” 错误

<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个为空或不是对象”

+2

数据对象如何填充? – karthikr

+0

发生此错误时,“data”的运行时值是什么?显然它没有'resultCount'成员。 – David

+0

也许你在页面完全加载之前触发你的函数。 – MahanGM

回答

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' 
} 
相关问题