【问题标题】:How to add links in mesage in popup window in javascript alert?如何在javascript警报的弹出窗口中添加消息中的链接?
【发布时间】:2020-06-29 13:38:09
【问题描述】:

我有一个存储数据的函数,在该函数之后我想给出一个带有链接的弹出消息。我能够提交数据并使用警报创建弹出窗口。但是在文本中添加链接是我想要的。下面是我试过的代码。

<!DOCTYPE html>
<html>
<base target="_top">

    <head>
    <script type="text/javascript">
    
    
          
    function myfunction(from){
    (function($){
    var id = $("#id");
    var wnum = $("#wnum");
   var id = id[0]['value']
   var wnum = wnum[0]['value']

    
    
    
      if(from == 'submit'){
    submitData(id,wnum) // data submitted
    var str = "Inform us!";
   
   var result = str.link("some_link");
   alert("Thank you for submitting the form. "+result);
}   
})(jQuery);
}
</script>
       
<body>
  <div class="cen">
    <div class="wrapper">    
        <h1>Font Selector</h1>
        <fieldset class="fontForm grid">
    <div class="grid-cell">
            <div class="grid-cell size1of1">
    <label for="fname">Order Id</label>
    <input type="text" id="id" name="id" placeholder="Enter order id" >
    <label for="fname">WhatsApp Number</label>
    <input type="text" id="wnum" name="wnum" placeholder="Enter WhatsApp number">
      <p><button onclick="myfunction('submit')">Submit</button></p>
    </div>          
    </div>   
</body>
</html>

我该怎么做?

【问题讨论】:

标签: javascript html popup popupwindow


【解决方案1】:

你不能用alert。您将必须构建一个不使用它的警报对话框,例如使用 bootbox 或您自己构建的东西。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-06
    • 2020-12-15
    • 1970-01-01
    相关资源
    最近更新 更多