DHTMLX Docs & Samples Explorer

Adding|Deleting tabs

Adding|Deleting tabs


Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtabbar.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtabbar.js"></script>
 
<h1 id="init_tabbar_from_script">Adding|Deleting tabs</h1>
<div id="a_tabbar" style="width:595px; height:190px;"></div>
        <br/>
<input type='button' value='Delete active tab' onclick='tabbar.removeTab(tabbar.getActiveTab(),true)'>
<input type='button' value='Add new tab at last position' onclick='add(-1)'>
<input type='button' value='Add new tab at first position' onclick='add(0)'>
 
 
 
<script>
tabbar = new dhtmlXTabBar("a_tabbar", "top");
tabbar.setSkin('dhx_skyblue');
tabbar.setImagePath("../../codebase/imgs/");
tabbar.addTab("a1", "Tab 1-1", "100px");
tabbar.addTab("a2", "Tab 1-2", "100px");
tabbar.addTab("a3", "Tab 1-3", "100px");
tabbar.addTab("a4", "Tab 1-4", "100px");
tabbar.addTab("a5", "Tab 1-5", "100px");
tabbar.setTabActive("a1");
function add(pos) {
    var id = (new Date()).valueOf();
    if (pos == -1);
    tabbar.addTab(id, "new text", "*");
    else;
    tabbar.addTab(id, "new text", "*", pos);
}
</script>