JavaScript Tutorial/Dojo toolkit/ComboButton
Add Icon to ComboButton MenuItem
<html>
<head>
<link rel="StyleSheet" type="text/css"
href="js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/",
parseOnLoad : true
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script>
dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.Menu");
function save_function() {
alert("Save");
}
function save_as_function(choice) {
alert("Save As");
}
</script>
</head>
<body class="tundra">
<div dojoType="dijit.form.ruboButton" onclick="save_function">
<span>File</span>
<div dojoType="dijit.Menu" id="saveMenu" toggle="fade" style="display: none;">
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave" onclick="save_function">
Save
</div>
<div dojoType="dijit.MenuItem" onclick="save_as_function">
Save As
</div>
</div>
</div>
</body>
</html>
ComboButton click event
<html>
<head>
<link rel="StyleSheet" type="text/css"
href="js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/",
parseOnLoad : true
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script>
dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.Menu");
function save_function() {
alert("Save");
}
function save_as_function(choice) {
alert("Save As");
}
</script>
</head>
<body class="tundra">
<div dojoType="dijit.form.ruboButton" onclick="save_function">
<span>File</span>
<div dojoType="dijit.Menu" id="saveMenu" toggle="fade" style="display: none;">
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave" onclick="save_function">
Save
</div>
<div dojoType="dijit.MenuItem" onclick="save_as_function">
Save As
</div>
</div>
</div>
</body>
</html>
ComboButton MenuItem click event
<html>
<head>
<link rel="StyleSheet" type="text/css"
href="js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/",
parseOnLoad : true
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script>
dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.Menu");
function save_function() {
alert("Save");
}
function save_as_function(choice) {
alert("Save As");
}
</script>
</head>
<body class="tundra">
<div dojoType="dijit.form.ruboButton" onclick="save_function">
<span>File</span>
<div dojoType="dijit.Menu" id="saveMenu" toggle="fade" style="display: none;">
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave" onclick="save_function">
Save
</div>
<div dojoType="dijit.MenuItem" onclick="save_as_function">
Save As
</div>
</div>
</div>
</body>
</html>