另一个文件夹和文件上的document.getElementById

时间:2019-01-14 06:28:19

标签: javascript html

我试图在单击注册后尝试触发模式(如果满足所有注册条件)。在我的情况下我该怎么做?

visuals

modal_popup(js):id = register必须在var btn中

var modal = document.getElementById('myModal');

var btn = document.getElementById("");

var span = document.getElementsByClassName("close")[0];

btn.onclick = function() {
  modal.style.display = "block";
}

span.onclick = function() {
  modal.style.display = "none";
}

window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}

注册(卡片):想在这里注册作为第一个代码中的变量。

<input type="submit" class="btn form-control color-white mwc-orange-background-color" id="register" name="register" value="REGISTER">

模式:

<div id="myModal" class="modal">


  <div class="modal-content">
    <div class="modal-header">
      <span class="close">&times;</span>
      <h2>Welcome, New White Card Holder!</h2>
    </div>
    <div class="modal-body spacer-left spacer-right">
      <br>
      <h3>Congratulations, you are entitled for a 30-day free trial of our Elite Membership.</h3>
      <h3>Enjoy a wealth of deals for wellness!</h3>
      <h3>If you wish to avail of our other membership options, click here.</h3>
      <br>
    </div>
    <div class="modal-footer">
      <h3>WAT</h3>
    </div>
  </div>

</div>

0 个答案:

没有答案