SCRIPT5007:无法获得物业'长度'未定义或空引用

时间:2015-03-19 20:24:06

标签: javascript internet-explorer-11

我得到"无法获得财产'长度'未定义或空引用"在IE11中。该函数如下所示:

function chgSupr(val) {
    var suprDD = eval('document.getElementById.col1LIAB_SUPERVISOR_CODE');
    suprDD.length = 0;
    if (!(val == '_')) {
        var suprAryStr = '<select name="col1LIAB_SUPERVISOR_CODE" style="width: 150px;" required>';
        var suprDD = eval('document.getElementById.col1LIAB_SUPERVISOR_CODE');
        suprDD.length = 0;
        suprAryStr += '<option value=""""></option>';
        for (i = 0; i < suprAry[val].length; i++) {
            tmpAry = suprAry[val][i].split('|~|');
            suprDD.length++;
            if (tmpAry[0].length > 1) {
                suprDD[i].value = tmpAry[0];
                suprDD[i].text = tmpAry[1] + '|' + tmpAry[0];
            } else {
                suprDD[i].value = "";
                suprDD[i].text = "";
            }
            suprAryStr += '<option value="' + tmpAry[0] + '">' + tmpAry[1] + '</option>';
        }
        suprAryStr += '</select>';

    } else {
        suprDD.length = 0;
    }
}

我不确定是什么导致它出错。

1 个答案:

答案 0 :(得分:0)

 var suprDD = eval('document.getElementById.col1LIAB_SUPERVISOR_CODE') // is not corrent.
document.getElementById("") //use this or 
eval('document.getElementById("")').

应避免使用。