向DOJO对话框添加图像(警报)

时间:2011-05-31 13:37:58

标签: dojo

<div dojoType="dijit.Dialog" 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>

我可以将图像添加到dojo对话框吗?使它看起来像一个警报框或什么?以上是我目前的代码?

这样的东西

enter image description here

2 个答案:

答案 0 :(得分:2)

是的,这是可能的。 dijit.Dialog可以有任何内容,也有其他dijit Widgets。当前1.6.1版本的一些dijit.Dialog示例:

http://download.dojotoolkit.org/release-1.6.1/dojo-release-1.6.1/dijit/tests/test_Dialog.html

答案 1 :(得分:1)

您需要一种名为'alertIcon'的CSS样式,例如:

.alertIcon {
    width:32px;
    height:32px;
    background-repeat:no-repeat;
    background: url("path/to/alert/icon/alertIcon.png");
}

这是一些经过修改的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>
相关问题