Search code examples
javascriptdhtml

DHTMLX Visual Editor. How to use generated code


I'm a bit new to web-programming. Using DHTML 3.0 Visual Designer I created a small web-page with the following automatically generated code:

dhtmlx.image_path='./codebase/imgs/';

    var main_layout = new dhtmlXLayoutObject(document.body, '1C');

    var a = main_layout.cells('a');
    a.setHeight('0');
    a.setWidth('0');
    a.hideHeader();
    a.fixSize(0,1);
    var toolbar_2 = a.attachToolbar();
    toolbar_2.setIconsPath('./codebase/imgs/');

    toolbar_2.loadXMLString('<toolbar><item type="button" text="" img="dhtmlxSuite/dhtmlxToolbar/codebase/imgs/dhxtoolbar_dhx_web/save.gif" imgdis="" title="Actualizar" /><item type="button" text="" img="dhtmlxSuite/dhtmlxToolbar/codebase/imgs/dhxtoolbar_dhx_web/text_document.gif" imgdis="" title="Editar" /><item type="button" text="" img="dhtmlxSuite/dhtmlxToolbar/codebase/imgs/dhxtoolbar_dhx_web/print.gif" imgdis="" title="Imprimir" /></toolbar>', function(){});

    var toolbar_1 = main_layout.attachToolbar();
    toolbar_1.setIconsPath('./codebase/imgs/');

    toolbar_1.loadXMLString('<toolbar><item type="button" text="N1" img="" /><item type="separator" /><item type="button" text="N2" /><item type="separator" /><item type="button" text="N3" img="" /><item type="separator" /><item type="button" text="N4" /><item type="separator" /><item type="button" text="N5" /></toolbar>', function(){});

I don't understand how to put this code into HTML page. I tried to surround this code with <script> tags, create function doOnLoad(), and then add <body onload="doOnLoad()" style="width:100%; height:100%; margin:0px; overflow:hidden;">. But it does not work.


Solution

  • Check the docs

    You need to

    • place basic html tags
    • include dhtmlx.js and dhtmlx.css
    • place script block, and paste the code from designer