草庐IT

closeThis

全部标签

javascript - 自动调用 onclick 事件

我编写了一个名为MyClass的JavaScript类,我在其中定义了一个方法closeThisMyClass=function(){this.closeThis=function(){document.getElementById("hidePane").style.display='none';}}现在,在我的html中,我尝试按如下方式调用它...functioncallThis(){varmyclassObj=newMyClass();document.getElementById("closeButton").onclick=myclassObj.closeThis();}上