How to add image in alert or in propmts.alert using JavaScript XUL - Stack Overflow

Mozilla XUL offers various types of alert and notification box messages. But, still why can't we ha

Mozilla XUL offers various types of alert and notification box messages. But, still why can't we have an image in the alert message?

    var prompts = Components.classes["@mozilla/embedp/prompt-service;1"]
                        .getService(Components.interfaces.nsIPromptService);

   prompts.alert(null, contact, "No Email Address")

The above code to display an alert with custom title message. When we check the nsIPromptService, it give various options but still there is no possibility of adding an image according to my knowledge.

When we check the popup in XUL, we can add an image but the alert will display in the corner of the system because it's using the nsIAlertsService and the display of this pop-up is platform independent.

Would it be possible to have an image in the alert box or in the prompts.alert box using JavaScript in XUL?

https://developer.mozilla/en/XPCOM_Interface_Reference/nsIPromptService#prompt_example https://developer.mozilla/en/Code_snippets/Alerts_and_Notifications

Mozilla XUL offers various types of alert and notification box messages. But, still why can't we have an image in the alert message?

    var prompts = Components.classes["@mozilla/embedp/prompt-service;1"]
                        .getService(Components.interfaces.nsIPromptService);

   prompts.alert(null, contact, "No Email Address")

The above code to display an alert with custom title message. When we check the nsIPromptService, it give various options but still there is no possibility of adding an image according to my knowledge.

When we check the popup in XUL, we can add an image but the alert will display in the corner of the system because it's using the nsIAlertsService and the display of this pop-up is platform independent.

Would it be possible to have an image in the alert box or in the prompts.alert box using JavaScript in XUL?

Share Improve this question edited Mar 8, 2013 at 9:01 j0k 22.8k28 gold badges81 silver badges90 bronze badges asked Aug 26, 2011 at 10:29 linguinilinguini 1,9397 gold badges49 silver badges80 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

Why don't you use a custom alert dialog as discussed HERE ?

XUL for the alert with image may be like:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<dialog id="alertprompt" title="Alert"
   xmlns="http://www.mozilla/keymaster/gatekeeper/there.is.only.xul"
   xmlns:html="http://www.w3/1999/xhtml"
   buttons="accept"
   buttonlabelaccept="Ok"
   height="160"
   width="260"
   ondialogaccept="return alert_prompt.doOK();">

   <script type="application/javascript" src="chrome://hello/content/alert_prompt.js"/>
    <label id="title" value="Title may go here!" align="center" class="header"/>
    <html:table>
        <html:tr>
            <html:td>
                <html:img src="Firefoxlogo.png" width="30" height="30"/>
            </html:td>
            <html:td>
                <label id="result" value="This place will display your message." align="center"/>
            </html:td>
        </html:tr>
    </html:table>
</dialog>

It will look something like:

Does it meet your requirement?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745079798a4610054.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信