<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
</script>
<script>
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.form.ComboBox");
var storeData = {
identifier: 'abbr',
label: 'name',
items: [{
abbr: 'ec',
name: 'Ecuador',
capital: 'Quito',
label:"<img width='16px' height='16px' src='images/one.jpg'/>Ecuador"
},
{
abbr: 'eg',
name: 'Egypt',
capital: 'Cairo',
label:"<img width='16px' height='16px' src='images/two.jpg'/>Egypt"
},
{
abbr: 'sv',
name: 'El Salvador',
capital: 'San Salvador',
label:"<img width='16px' height='16px' src='images/three.jpg'/>El Salvador"
},
{
abbr: 'gq',
name: 'Equatorial Guinea',
capital: 'Malabo',
label:"<img width='16px' height='16px' src='images/four.jpg'/>Equatorial Guinea"
},
{
abbr: 'er',
name: 'Eritrea',
capital: 'Asmara',
label:"<img width='16px' height='16px' src='images/five.jpg'/>Eritrea"
},
{
abbr: 'ee',
name: 'Estonia',
capital: 'Tallinn',
label:"<img width='16px' height='16px' src='images/six.jpg'/>Estonia"
},
{
abbr: 'et',
name: 'Ethiopia',
capital: 'Addis Ababa',
label:"<img width='16px' height='16px' src='images/seven.jpg'/>Ethiopia"
}]
}
</script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"
/>
</head>
<body class=" claro ">
<div dojoType="dojo.data.ItemFileReadStore" data="storeData" jsId="countryStore">
</div>
<div dojoType="dijit.form.ComboBox" store="countryStore" labelAttr="label" labelType="html">
</div>
</body>
備案應別人有這個問題,只要剪切和粘貼上面看到這個動作。你將不得不爲自己的圖標找到自己的圖像,但這是有效的。珍妮
這是很好的建議。唯一的問題是我需要保持組合框的功能,如果它們不在列表中,就可以添加值。 :-( – 2011-06-07 18:25:30
看看ComboBox的測試;它們有一個帶有Rich Text的ComboBox的例子,它可能是你想要的,這個測試在以下目錄中:dijit/tests/form/test_ComboBox.html。你需要要有完整的Dojo源代碼來查看測試,請在http://download.dojotoolkit.org/release-1.6.1/dojo-release-1.6.1-src.zip下載它。 – faken 2011-06-07 18:41:54