<div dojoType="dijit.Dialog开发者_Go百科" id="errorDialog" title="An error occured" style="display: none">
<p id="errorMessage">An unexpected error occurred</p>
<button dojoType="dijit.form.Button" type="submit" onClick="hideErrorDialog();">
OK
</button>
Can I add an image to a dojo dialog? to to make it appear like an alert box or something? Above is my current code?
Something like
Yes it is possible. dijit.Dialog can have any content, also other dijit Widgets. Some dijit.Dialog Examples for the current 1.6.1 version:
http://download.dojotoolkit.org/release-1.6.1/dojo-release-1.6.1/dijit/tests/test_Dialog.html
You will need a CSS style called 'alertIcon', something like:
.alertIcon {
width:32px;
height:32px;
background-repeat:no-repeat;
background: url("path/to/alert/icon/alertIcon.png");
}
and here is some modified HTML:
<div dojoType="dijit.Dialog" id="errorDialog" title="An error occured" style="display: none">
<div>
<span class="dijitInline alertIcon"></span>
<span id="errorMessage" class="dijitInline">An unexpected error occurred</span>
</div>
<button dojoType="dijit.form.Button" type="submit" onClick="hideErrorDialog();">
OK
</button>
精彩评论