首页 > 解决方案 > 如何使用 JavaScript 创建自定义弹出窗口

问题描述

我有一个 SendMail 按钮,单击它会调用 JavaScript 函数。验证后会发出警报消息。但这是我正在使用的默认警报。如何在 JavaScript 中创建自定义警报。

我的 HTML 代码:

       <div id ="sendmail" style="display: none;">
        <div class="container">
        <div style="text-align:right; width:100%; padding:0;">
        <button id ="cancel" style='margin-right:16px' class="btn btnprimary btn-lg pull-right" a href="javascript:window.history.back()">Cancel</button>
        <button id ="sendMail" style='margin-right:16px'  class="btn btn-primary btn-lg pull-right" onclick="sendMail()">SendMail</button>

这是我的 index.js 文件

        function sendMail(){
        console.log(employee_id);
        var employeeid = employee_id;
$.ajax({
  url:'http://localhost:8088/JirasTrackingApp/reporter/
  Reportees/JiraNames/'+employeeid,
    type:'GET',

    success: function(Jiranumbers){
             alert("Mail is sent successfully");  //here I need to be able to call the customized alert instead of that default alert
            },
      error: function(Jiranumbers){
            alert("Mail is not sent successfully");
        }        
    });

请指教,谢谢。

标签: javascripthtml

解决方案


您的问题与此非常相似,我知道您在此查询中得到了答案。 如何更改警告框的样式


推荐阅读