0

I want to append html in body of currently openned tab. when i put my code in background js it append the html in background.html and when i use same code in poPup js it append it on poPup.hmtl. i want myDiv to be append to currently openned tab html. there is code that m using

var myDiv = document.createElement("div");
myDiv.style.backgroundColor = "rgb("+ r +","+ g +","+ b +")";
myDiv.style.position        = "fixed";
myDiv.style.width           = "500px";
myDiv.style.height          = 200 + "px";
myDiv.style.top             = 200 + "px";
myDiv.innerHTML = "hi this is test";
Document.getElementsByTagName("body")[0].appendChild(myDiv);
4

1 回答 1

1

您应该将内容脚本注入当前打开的选项卡并从那里运行您的代码。

于 2013-04-29T10:58:23.603 回答