I have a toolbarbutton and I want it to toggle a toolbox > toolbar when it is clicked. I thought there might be an internal function开发者_JAVA百科 similar to toggleSidebar(id)
but I cannot find it.
Well there is no function, however there is a simple solution for anyone looking for it.
First on the toolbarbutton add the following attribute:
oncommand="extName.toggleToolbar(event);"
then in the javascript:
toggleToolbar: function(e) {
var toolbar = document.getElementById('uniqueName-toolbar');
if(toolbar.getAttribute('hidden')== 'true'){
toolbar.setAttribute('hidden', false);
}
else{
toolbar.setAttribute('hidden', true);
}
}
精彩评论