Microsoft JScript运行时错误:属性的值' a'是null或undefined,不是Function对象

时间:2014-07-03 15:16:28

标签: javascript vb.net undefined

不确定为什么会抛出此错误,我没有看到错误定义函数的方式。

//onclick method

HTMLButtonElement.addEventListener("click", a);

button.onClick = function () { a };

function a(parentIndex) {
    var strParam = toString(parentIndex);
    if (strParam.contains("Summary")) {
        alterStyleSummary(HTMLButtonElement, selectedTbody);
    }
    else {
        alterStyle(HTMLButtonElement, selectedTbody);
    }
}

//method selected if summary collapse button is clicked, hides or shows child tasks
function alterStyleSummary(button, selectedTbody) {
    var selectedTbody = document.getElementsByName(parentIndex);
    //changes background image of button to + or -
    if (button.class = "expand") {
        button.class = "collapse";
        selectedTbody.style.display = 'none';
    }
    else {
        button.class = "expand";
        selectedTbody.style.display = '';
    }
}
//method selected if unassigned collapse button is clicked, hides or shows child tasks
function alterStyle(button, selectedTbody) {
    var selectedTbody = document.getElementById(parentIndex);
    //changes background image of button to + or -
    if (button.class = "expand") {
        button.class = "collapse";
        selectedTbody.style.display = 'none';
    }
    else {
        button.class = "expand";
        selectedTbody.style.display = '';
    }
}

0 个答案:

没有答案