我在附加组件中有一个功能,我在页面中有一个图像。当用户单击图像时,如何从加载项中调用该函数?
<img src='something' onclick="thisfunction();"> //what is need to call thisfuntion function in the add-on?
//in the add-on:
function thisfunction(){ .... }
答案 0 :(得分:0)
您注入网页的HTML代码是什么?然后你应该附加一个事件监听器:
img.addEventListener("click", thisfunction, false);