不确定为什么会抛出此错误,我没有看到错误定义函数的方式。
//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 = '';
}
}