Calling a method from XBL

前端 未结 2 1368
不思量自难忘°
不思量自难忘° 2021-01-28 06:22

From a XBL method, when I need to call another method, I do like:

        
            
                

        
2条回答
  •  天涯浪人
    2021-01-28 07:03

    can you show us code calling myMethod_2? If you call it like: document.getElement(...).myMethod_2() that's fine, but if you have something like someElement.addEventHandler("click", myxbl.myMethod_2,...); that won't work since event target will be this.

    This is important for determining what is this in that context

    EDIT: (Tom's reply)

    ow, think I got it.. it's exactly this the problem.. I'm calling it from a keypress listener of another document, and the "this" was not what I think..

提交回复
热议问题