我尝试创建一个指向 popup.js 文件的 list ,并将以下代码放入该文件中,但弹出窗口仅显示为一个白色方 block 。
这是我的 JavaScript 代码
fill(0, 0, 0);
ellipse(200, 200, 375, 375);
fill(60, 0, 255);
triangle(200, 104, 280, 280, 120, 280);
fill(255, 255, 255);
var answer = floor(random(1, 20));
if (answer === 1) {
text("As I see it,", 171, 200);
text("yes", 189, 229);
}
else if (answer === 2) {
text("Ask again", 171, 200);
text("later", 189, 229);
...
else {
text("You may", 175, 200);
text("rely on it", 177, 229);
}
这是我的 list (很可能需要一些编辑)
{
"manifest_version": 2,
"name": "8 ball popup",
"version": "0.1",
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["content.js"]
}
],
"browser_action": {
"default_popup": "popup.html",
"default_title": "Your fortune will appear here."
}
}
最佳答案
关于javascript - 我有一些简单的 JavaScript 代码,我想将其变成弹出扩展。我该怎么做呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61602230/