开发者

FF extension: a popup with dynamic menuitems, with each menu item having another popup

I am building an extension that has a popup whose elements are constructed by a function call everytime the mouse hovers over the popup option. I am able to achieve this. Now I need to have a popup for each of the menu item (inside the original popup) which is not dynamic though. I have this code, but it does not work:

var myMenuPopup = document.getElementById("file-popup4");

for (var m=0; m<localpubliclist.length; m++)
{

    var newItem = document.createElement("menupopup");

    newItem.setAttribute("label", publicdisplayname[m]);

    newItem.setAttribute("id", "public" + m);

    var new1 = document.createElement("menuitem");
    new1.setAttribute("label","Home");
    new1.setAttribute("id", "publichome" + m);
    newItem.onclick = function(){
    };
    newItem.appendChild(new1);
    myMenuPopup.appendChild(newItem);

but this doesnt work. That is, the popup(newitem) does not open. Can someone please help me out with whats开发者_StackOverflow社区 the problem


Have you tried the onpopupshowing event (https://developer.mozilla.org/en/XUL/menupopup#a-onpopupshowing)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜