简体   繁体   中英

popup window with confirmation box in asp.net

Hi I am trying to display a confirmation box . I wrote the code below, and when I click the OK or Cancel buttons, it should close the popup window . But it's not closing for me. Can anyone help me solve this? Below is the html code . One more thing. If I use javascript it shows error $ is undefined. Can anyone help me solve this or suggest other options?

 <div class="box">
<a class="button" href="#popup1">Let me Pop up</a>
</div>

<div id="popup1" class="overlay">
<div class="popup">
    <h2>Here i am</h2>
    <a class="close" href="#">×</a>
    <div class="content">
        Thanks for pop me out of that button, but now i'm done so you can close this window.
    </div>
<asp:Button ID="btnOk" runat="server" Text="OK" />

        <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</div>

Try like this

function close_window() {
      if (confirm("Close Window?")) {
        close();
      }
    }

with HTML:

<a href="javascript:close_window();">x</a>

or:

<a href="#" onclick="close_window();return false;">x</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM