JSON string

JSON string


JSON string with image


JSON string with checkbox

</> Source
<!DOCTYPE html>
<html>
<head>
	<title>JSON string</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() {

			// JSON string
			myCombo = new dhtmlXCombo("combo_zone");
			myCombo.load('{options:['+
						'{value: "1", text: "Copenhagen Airport"},'+
						'{value: "2", text: "Dublin Airport", selected: true},'+
						'{value: "3", text: "Frankfurt Airport"}'+
					']}');

			// JSON string with image
			myCombo2 = new dhtmlXCombo("combo_zone2", null, null, "image");
			myCombo2.setImagePath("../common/flags/");
			myCombo2.load('{options:['+
						'{value: "1", img: "austria.png", text: "Austria"},'+
						'{value: "2", img: "cameroon.png", text: "Cameroon"},'+
						'{value: "3", img: "canada.png", text: "Canada", selected: true}'+
					']}');

			// JSON string with checkbox
			myCombo3 = new dhtmlXCombo("combo_zone3", null, null, "checkbox");
			myCombo3.load('{options:['+
						'{value: "1", text: "The Adventures of Tom Sawyer"},'+
						'{value: "2", text: "The Dead Zone", selected: true, checked: true},'+
						'{value: "3", text: "The First Men in the Moon", checked: true}'+
					']}');
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h3>JSON string</h3>
	<div id="combo_zone" style="width:230px;"></div>
	<br>
	<h3>JSON string with image</h3>
	<div id="combo_zone2" style="width:230px;"></div>
	<br>
	<h3>JSON string 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.