【问题标题】:ASP.Net button and jQuery PopUp FormASP.Net 按钮和 jQuery 弹出窗体
【发布时间】:2013-11-20 01:53:48
【问题描述】:

下面是我用于模态弹出表单的代码

$("[id*=btnFinish").live("click", function () {
    $("#timeLeft").dialog({
        title: "There's Time Left!!",
        open: function (event, ui) {
            $(".ui-dialog-titlebar-close").hide();
        },
        modal: true,
        draggable: false,
        resizable: false
    });
    return false;
});
} else {
    $("#timesUp").dialog({
        title: "Time is up!",
        open: function (event, ui) {
            $(".ui-dialog-titlebar-close").hide();
        },
        modal: true,
        draggable: false,
        resizable: false
    });
}

...

<div id="timesUp" style="display: none">
    Click proceed to start the first exam module.
    <br /><br />
<asp:Button ID="btnProce" runat="server" UseSubmitBehavior="false" Text="PROCEED" />
</div>
<div id="timeLeft" style="display: none">
You can go back, review your answers and change them if needed. Or you can continue to the next module and click Proceed.
<br /><br />
<asp:Button ID="btnBack" runat="server" UseSubmitBehavior="false" Text="BACK" />&nbsp;
<asp:Button ID="btnProceed" runat="server" UseSubmitBehavior="false" Text="PROCEED" />
</div>

在我后面的代码中,div="timeLeft" 拥有两个按钮 btnProceedbtnBackbtnProceeddiv="timesUp" 中的btnProce 功能相同。现在,我的问题是当显示 div="timeLeft" 的模态弹出窗口并且当用户单击btnBack 时,我希望模态弹出窗口关闭并执行后面的代码。我真的不知道该怎么做。

【问题讨论】:

  • 你用的是什么版本的jQuery?
  • 这些是我的脚本:

标签: jquery asp.net


【解决方案1】:

添加

$("#btnBack").trigger('click');

在 if 语句下,应该是这样的

$("[id*=btnFinish").live("click", function () {
    $("#timeLeft").dialog({
        title: "There's Time Left!!",
        open: function (event, ui) {
            $(".ui-dialog-titlebar-close").hide();
            $("#btnBack").trigger('click');
        },
        modal: true,
        draggable: false,
        resizable: false
    });
    return false;
});
} else {
    $("#timesUp").dialog({
        title: "Time is up!",
        open: function (event, ui) {
            $(".ui-dialog-titlebar-close").hide();
        },
        modal: true,
        draggable: false,
        resizable: false
    });
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-07
    • 2011-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多