Script - single option

Single option


Single option with image


Single option with checkbox

</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Script - single option</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		
		var myCombo, myCombo2, myCombo3;
		function doOnLoad() {
			
			// Single option at time
			myCombo = new dhtmlXCombo("combo_zone");
			myCombo.addOption("1", "Walking through the city", "color:red;", null, true);
			myCombo.addOption("2", "Looking oh so pretty", "color:green;");
			myCombo.addOption("3", "I've just got to find my way", "color:blue;");
			myCombo.addOption("4", "See the ladies flashing", "color:magenta;");
			myCombo.addOption("5", "All their legs and lashes", "color:darkorange;");
			myCombo.addOption("6", "I've just got to find my way", "color:brown;");
			
			// Single option with image
			myCombo2 = new dhtmlXCombo("combo_zone2", null, null, "image");
			myCombo2.setImagePath("../common/flags/");
			myCombo2.addOption("1", "Finland", null, "finland.png", true);
			myCombo2.addOption("2", "Germany", null, "germany.png");
			myCombo2.addOption("3", "Great Britain", null, "britain.png");
			myCombo2.addOption("4", "Hungary", null, "hungary.png");
			
			// Single option with checkbox
			myCombo3 = new dhtmlXCombo("combo_zone3", null, null, "checkbox");
			myCombo3.addOption("1", "The Adventures of Tom Sawyer");
			myCombo3.addOption("2", "The Dead Zone", null, null, true);
			myCombo3.addOption("3", "The First Men in the Moon");
			myCombo3.addOption("4", "The Girl Who Loved Tom Gordon");
			myCombo3.addOption("5", "The Green Mile");
			myCombo3.addOption("6", "The Invisible Man");
			myCombo3.addOption("7", "The Island of Doctor Moreau");
			myCombo3.addOption("8", "The Prince and the Pauper");
			myCombo3.setChecked("2", true); // index
			myCombo3.setChecked("5", true);
			myCombo3.setChecked("6", true);
			
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h3>Single option</h3>
	<div id="combo_zone" style="width:230px;"></div>
	<br>
	<h3>Single option with image</h3>
	<div id="combo_zone2" style="width:230px;"></div>
	<br>
	<h3>Single option with checkbox</h3>
	<div id="combo_zone3" style="width:230px;"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.