Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Tabbox

Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Handling onclosetab Event

Assuming the tabbox, tabs, and tabpanels widgets with id's the same as their nodeName, this function will correctly remove the current tab and tab panel for the onclosetab tabs event:

function removeTab(){
    var tabbox = document.getElementById("tabbox");
    var currentIndex = tabbox.selectedIndex;
    if(currentIndex>=0){
    var tabs=document.getElementById("tabs");
    var tabpanels=document.getElementById("tabpanels");
    tabpanels.removeChild(tabpanels.childNodes[currentIndex]);
    tabs.removeItemAt(currentIndex);
    /*Work around If last tab is removed, widget fails to advance to next tab*/
    if(-1 == tabbox.selectedIndex && tabs.childNodes.length>0){
        tabbox.selectedIndex=0;
    }
}

Creating a close tab button

To have a tab close button, you must configure the style.

Examples:

   .tabs-closebutton {
     list-style-image: url(https://mozilla.org/favicon.ico);
   } 
   .tabs-closebutton {
     list-style-image: url("chrome://global/skin/icons/Close.gif");
   } 

Document Tags and Contributors

 Contributors to this page: wbamberg, Pc1oad1etter, Sheppy
 Last updated by: wbamberg,