开发者

Add an image (alert) to DOJO dialog

开发者 https://www.devze.com 2023-03-09 18:09 出处:网络
<div dojoType=\"dijit.Dialog开发者_Go百科\" id=\"errorDialog\" title=\"An error occured\" style=\"display: none\">
<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

Add an image (alert) to DOJO dialog


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消