我已经在需要暂停确认框的情况下被触发。这是我做了什么:需要暂停javascript的确认窗口
function onBeforeClientInsert(record) {
var eventtype = parseInt(record. < %= CEO.FieldEvaluator.GetEvaluatorByDId("EVENT_TYPE_ID").GetFieldDataFieldId() % >);
var begindate = record. < %= CEO.FieldEvaluator.GetEvaluatorByDId("BeginDate").GetFieldDataFieldId() % > ;
var enddate = record. < %= CEO.FieldEvaluator.GetEvaluatorByDId("EndDate").GetFieldDataFieldId() % > ;
$.ajax({
type: "POST",
url: "Data.aspx/CheckInsertRecord",
data: "{EventType:'" + eventtype + "',BeginDate:'" + begindate + "'," + "EndDate:'" + enddate + "' }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
if (msg.d == "No duplicate") {
} else {
alert(msg.d);
eval("var data = " + msg.d + ";");
}
var i = 0;
alert(i);
alert(data[i]);
do {
$("#beginDate").html(data[i].BeginDate);
$("#eventTypeID").html(data[i].EVENT_TYPE_ID);
$("#endDate").html(data[i].EndDate);
$("#beginlatlong").html(data[i].BeginLATLONG);
$("#endlatlong").html(data[i].EndLATLONG);
var modal = document.getElementById('Div1');
modal.style.display = '';
modal.style.position = 'fixed';
modal.style.zIndex = '100';
modal.style.left = '30%';
modal.style.top = '10%';
var screen = document.getElementById('modalScreen');
screen.style.display = '';
i++;
if (confirm("Are you sure you want to continue?") == false) {
hide();
continue;
}
}
while (msg.d != null);
}
});
if (confirm("Are you sure you want to insert this new record ?") == false) {
hide();
return false;
}
if (Page_ClientValidate("<%= CEO.GridUtils.Global_ValidationGroupName%>")) {
hide();
SetPostBackCause('INSERT');
return true;
}
return false;
}
所以,这个问题一直是
if (confirm("Are you sure you want to insert this new record ?") == false) {
hide();
return false;
}
将确认框中
if(confirm("Are you sure you want to continue?")==false){
hide();
continue;
}
后立即运行,但我想它被叫停直到用户点击第一个确认框上的某个东西。你可以让我知道如何做到这一点?如果我以错误的方式接近它,你还可以让我知道任何其他方式来做到这一点吗?
一旦你得到这个代码的工作,**请**发布在[代码评论](http://codereview.stackexchange.com)的清理建议。 –
@Matt:当然我会发布它 – Sayamima