Onclick action from html to firefox add-on
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);
精彩评论