我有:我想了解Firefox擴展,所以我下載了包含來自http://kb.mozillazine.org/Getting_started_with_extension_development的「Hello World」示例的zip文件。用於Firefox擴展的Javascript變量
在hello.xul我:
<hbox align="center">
<description flex="1">text in box</description>
</hbox>
(使文本 「文本框」 彈出框)
在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,以便該變量的內容是「打印」在框中的內容?