我想在弹出窗口中设置一个变量,标记为i
,然后将其发送到后台页面。我相信我可以把这个变量作为“请求”,但我可能是错的。当我尝试运行扩展时,我得到:弹出窗口和背景Chrome扩展之间的工作
Uncaught TypeError: Cannot call method 'sendRequest' of undefined
我缺少什么?
这里是我的popup.html文件:
var i = 0;
function start(){
alert("working");
chrome.tabs.sendRequest(i);
}
function add(){
i++;
document.getElementById('box').value=i;
}
function sub(){
i--;
document.getElementById('box').value=i;
}
看看[这个问题](http://stackoverflow.com/questions/4865850/google-chrome-extension-develompent)帮助你解决你的情况。 – 2011-12-27 08:45:11