我的代码有点像这样:
function ShowPopUpRestore() {
var returnval = 1;
var hddnField = document.getElementById(<%=hdnSelectedRows.ClientID%>");
if (hddnField.value != 0) {
returnVal = 0;
$('<div></div>').appendTo('body')
.html('<div><align="left"> </br>' + '<%= this.GetMessage("Msg1595")%>' + '</h6></div>')
.dialog({
resizable: false,
modal: true,
title: "",
height: 150,
width: 475,
buttons: {
Yes: function () {
// //__doPostBack(mDdlSurgeryListRE.name, '');
$(this).dialog("close");
},
"No": function () {
$(this).dialog('close');
}
},
close: function (event, ui) {
$(this).remove();
}
}).prev(".ui-dialog-titlebar").css("background", "#4E2D1D");
}
return false;
}
假设我的一个数据处于挂起模式,我希望它处于活动模式,所以我试图通过单击恢复按钮来恢复它。 当我点击复选框并尝试点击恢复按钮时,弹出窗口应该会出现“是”&#39; /&#39; no&#39;按钮:
它对多个复选框(数据)有效。谢谢。
答案 0 :(得分:1)
在jQuery中创建以下事件非常简单,并将它们绑定到ShowPopUpRestore():
click()
事件。change()
事件。完整示例:
<head runat="server">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet">
<script type="text/javascript">
$(function () {
$("#btnRestore").click(function () {
ShowPopUpRestore();
});
$("#chkBtn").change(function () {
ShowPopUpRestore();
});
function ShowPopUpRestore() {
var returnval = 1;
var hddnField = document.getElementById("<%=hdnSelectedRows.ClientID%>");
if (hddnField.value != 0) {
returnVal = 0;
$('<div></div>').appendTo('body').html('<div><align="left"></br>' + '<%= this.GetMessage("Msg1595")%>' + '</h6></div>')
.dialog({
resizable: false,
modal: true,
title: "",
height: 150,
width: 475,
buttons: {
Yes: function () {
$(this).dialog("close");
alert('You clicked YES');
},
"No": function () {
$(this).dialog('close');
alert('You clicked NO');
}
},
close: function (event, ui) {
$(this).remove();
}
}).prev(".ui-dialog-titlebar").css("background", "#4E2D1D");
}
return false;
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<input type="button" id="btnRestore" value="Restore" />
<input type="checkbox" id="chkBtn" value="Check box" />
<asp:HiddenField ID="hdnSelectedRows" runat="server" Value="1" />
</form>
</body>