gpt4 book ai didi

Firefox 扩展中使用的 Javascript 变量

转载 作者:行者123 更新时间:2023-11-30 13:27:38 24 4
gpt4 key购买 nike

我有:我想了解 Firefox 扩展,所以我从 http://kb.mozillazine.org/Getting_started_with_extension_development 下载了包含“Hello World”示例的 zip 文件。 .

在 hello.xul 中我有:

<hbox align="center">
<description flex="1">text in box</description>
</hbox>

(给出一个带有文本“text in box”的弹出框)

在 overlay.js 中我有:

var HelloWorld = {
onLoad: function() {
// initialization code
this.initialized = true;
},

onMenuItemCommand: function() {
window.open("chrome://helloworld/content/hello.xul", "", "chrome");
var a = "text I want in box";
}
};

window.addEventListener("load", function(e) { HelloWorld.onLoad(e); }, false);

问题:如何在 javascript 文件中使用变量 a,以便该变量的内容是“打印”在框中的内容?

最佳答案

您需要将参数传递给新窗口。显示了一个示例 here

关于Firefox 扩展中使用的 Javascript 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7942416/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com