DHTMLX Docs & Samples Explorer

Initialization with Script

Using script initialization you can initalize colorpicker based on DIV element and specify its parameters directly in script

Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxcolorpicker.css">
     <script  src="../../codebase/dhtmlxcommon.js"></script>
      <script  src="../../codebase/dhtmlxcolorpicker.js"></script>
 
 
<div id="colorPicker" style="position:absolute;top:150;left:200;"></div>
<input type="button" value="Init" onclick="init1();" style="width:100px">
<script>
function init1() {
    var myCP1 = new dhtmlXColorPicker("colorPicker");
    myCP1.setImagePath("../../codebase/imgs/");
    myCP1.init();
}
</script> <input type="button" value="Init" onclick="init2();" style="width:100px"> <script>
function init2() {
    var myCP = new dhtmlXColorPicker("colorPicker", true);
    myCP.setImagePath("../../codebase/imgs/");
    myCP.init();
}
</script> <input type="button" value="Init" onclick="init4();" style="width:100px"> <script>
function init4() {
    var myCP = new dhtmlXColorPicker("colorPicker", null, true);
    myCP.setImagePath("../../codebase/imgs/");
    myCP.init();
}
</script>