DHTMLX Docs & Samples Explorer

### Spacer

Source

    <script type="text/javascript" src="../../codebase/dhtmlxcommon.js"></script>
    <script type="text/javascript" src="../../codebase/dhtmlxtoolbar.js"></script>
    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxtoolbar_dhx_skyblue.css"></link>

    <div style="height: 150px;"><div id="toolbarObj"></div></div>
    <select id="sel"></select>
    <input type="button" value="Add Spacer" onclick="addSpacer();">
    <input type="button" value="Remove Spacer" onclick="removeSpacer();">
    <script>var toolbar,
    sel;
    function doOnLoad() {
        sel = document.getElementById("sel");
        toolbar = new dhtmlXToolbarObject("toolbarObj");
        toolbar.setIconsPath("../common/imgs/");
        toolbar.loadXML("../common/dhxtoolbar.xml?etc=" + new Date().getTime(), function() {
            toolbar.hideItem("sep4");
            toolbar.addSpacer("paste");
            toolbar.forEachItem(function(id) {
                if (id != "sep4")
                    sel.options.add(new Option(id, id));
            });
        });
    }
    function addSpacer() {
        toolbar.addSpacer(sel.options[sel.selectedIndex].value);
    }
    function removeSpacer() {
        toolbar.removeSpacer();
    }</script>