Combo supports two special types:
<link rel="STYLESHEET" type="text/css" href="../codebase/dhtmlxcombo.css">
<script src="../codebase/dhtmlxcommon.js"></script>
<script src="../codebase/dhtmlxcombo.js"></script>
There are two ways of combo intialization:
In first case the type is set by the "opt_type" attribute of the <select> tag:
<select opt_type="checkbox" style="width:200px;" id="combo_zone" name="alfa">
...
</select>
<script> var combo = dhtmlXComboFromSelect("combo_zone");
</script>
When combo is initialized using dhtmlXCombo(...), you can define the type as follows:
<div id="combo_zone1" style="width:200px;"></div>
<script> var combo = new dhtmlXCombo("combo_zone1","alfa1",200,"image");
...
</script>
The option can be marked as checked with the help of one of the following methods:
<option value="some value" checked="1">some text</option>
/*the 4th and 7th options are checked*/
myCombo.setChecked(3,true);
myCombo.setChecked(6,true);
The array with values of selected options can be received by the getChecked() method:
var checked_array = combo.getChecked();
Image path is set by the "img_src" attribute:
<option value="some value" img_src="some.gif">some text</option>
The setDefaultImage(src) method allows setting the default image:
var combo = new dhtmlXCombo("combo_zone","alfa",200,"image");
combo.setDefaultImage("../images/book.gif");
...
Back to top