从html到firefox附加组件的onclick操作

时间:2011-09-02 19:03:00

标签: javascript firefox-addon

我在附加组件中有一个功能,我在页面中有一个图像。当用户单击图像时,如何从加载项中调用该函数?

<img src='something' onclick="thisfunction();"> //what is need to call thisfuntion function in the add-on?
//in the add-on:
function thisfunction(){ .... }

1 个答案:

答案 0 :(得分:0)

您注入网页的HTML代码是什么?然后你应该附加一个事件监听器:

img.addEventListener("click", thisfunction, false);