views:

45

answers:

0

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 the problem