简体   繁体   English

定制的javascript确认框

[英]customized javascript confirmation box

在此处输入图片说明 I have customized confirmation box....When I press the logout the box is displayed...If cancel is pressed the box is closed the control remains in the same page...When yes is pressed ,logout has to take place....For me,cancel is working fine...But when user presses yes, there is no response....Could anyone help me...Thanks in advance... 我有定制的确认框...。当我按注销时,将显示该框。如果按取消,则该框将关闭,控件仍保留在同一页面中。当按“是”时,必须进行注销。 ...对我来说,取消工作正常...但是当用户按yes时,则没有任何响应....任何人都可以帮助我...谢谢...

My code: 我的代码:

<s:a href="logout" cssClass="planTabHeader" id="logoutId"> <img src="../../KY/images/common/header/lock.png" alt="logout" style="border: none;background-color: transparent;" /> &nbsp;Log out</s:a>

javascript: javascript:

<script type = "text/javascript" > 
$(document).ready(function () {
    $($('#logoutId')).click(function (event) {


        var msg = "";
        var buttons = {};
        msg = "Are you sure you want to logout?";

        buttons["Yes"] = doLogout;

        buttons["Cancel"] = closeDialog;
        if (msg != "") {

            showDialog(buttons, "cancelConfirm", msg, "dialogNormal",
                "Confirmation", 470);

        }
        return false;
    });
});

function doLogout() {
    document.getElementById("logoutId").href = "logout";
}

function closeDialog() {
    /* alert("action is closeDialog"); */
    $("#cancelConfirm").dialog("close");
    $("#cancelConfirm").dialog("destroy");
} 
</script>

Expanding on my comment above maybe your function should be 在上面扩展我的评论,也许您的功能应该是

   function doLogout() {
window.location = "/logout"; // not sure on your url structure
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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