开发者

Onclick action from html to firefox add-on

开发者 https://www.devze.com 2023-04-02 07:01 出处:网络
I have a function in the add-on and I have an image in the page. How can I call that function from the add-on when the user 开发者_Python百科click on the image?

I have a function in the add-on and I have an image in the page. How can I call that function from the add-on when the user 开发者_Python百科click on the image?

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


Is that HTML code you inject into the web page? Then you should attach an event listener:

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

精彩评论

暂无评论...
验证码 换一张
取 消