0

在此处输入图像描述我有自定义确认框....当我按下注销时,显示框...如果按下取消,框关闭,控件保持在同一页面...按下是时,必须进行注销。 ...对我来说,取消工作正常...但是当用户按下“是”时,没有响应...。谁能帮助我...提前谢谢...

我的代码:

<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:

<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>
4

1 回答 1

1

扩展我上面的评论也许你的功能应该是

   function doLogout() {
window.location = "/logout"; // not sure on your url structure
  }
于 2013-04-18T14:43:38.280 回答