javascript - Checkbox in firefox extension -
i want place menu item extension has check.
<menupopup id="menu_toolspopup"> <menuitem type="checkbox" label="convert" id="menu_toolspopupitem"/> </menupopup>
overlay.js
window.addeventlistener("load", function() {myextension.init()}, false); init: function() { window.addeventlistener("copy", function() {myextension.test()}, false); }, test: function (win) { var x= document.getelementbyid("menu_toolspopupitem"); //not null!!! alert(x)=> [object xulelement] alert(x.checked);//-> undefined }
i don't state of menu item.
and how save selection after restart browser?
looks have access attribute -- there's no convenient property wrapper in case:
[attribute] checked type: boolean indicates whether element checked or not. use hasattribute() determine whether attribute set instead of getattribute().
https://developer.mozilla.org/en/xul/menuitem#a-checked
and how save selection after restart browser?
there quite possibly few different ways. first 1 comes mind store in preference. https://developer.mozilla.org/en/code_snippets/preferences
Comments
Post a Comment