复制代码代码如下所示:
函数方法(){
的…
$(数组、函数(){(){
如果(条件设置){
返回true;
}
});
的…
}

在函数中,有一个函数,每一个在每个条件下都成立,并返回这个函数为真或假。

但是不能在每个代码块中使用中断和继续,并使用其他方法来实现断开和继续的功能。
使用假返回;
继续使用返回;

因此,当我想使用返回true来返回每个函数时,它实际上只是让每个继续执行它。
甚至每一个都没有中断,所以函数不能返回。

解决方案:通过尝试捕获抛出错误,从中取出并返回错误的目标!
复制代码代码如下所示:
函数的CheckBatchRow(obj){
如果($(:=复选框{ ID美元'chkselect }:检查),大小()> 0){
{试
$(:=复选框{ ID美元'chkselect }:检查),每个(函数(){)
var前缀= this.id.replace(chkselect

无功txtdatestart = $(#+前缀+txtdatestart );
无功txtdateend = $(#+前缀+txtdateend );
如果(美元。修剪((txtdatestart。Val))=美元。修剪(txtdateend。Val)| | '()' = = {)
TxtDateStart.addClass(farevalidform );
TxtDateEnd.addClass(farevalidform );
对不起,请填写有效日期;

}
{其他
d1arr = txtdatestart.val(。分)(-);
d2arr = txtdateend.val(。分)(-);
V1 =新的日期(d1arr { 0 },d1arr { 1 },d1arr { 2 });
V2 =新的日期(d2arr { 0 },d2arr { 1 },d2arr { 2 });
如果(V2 < V1){
TxtDateEnd.addClass(farevalidform );
抛出对不起,结束日期不能少于开始日期!;
}
}

无功txtremaindamt = $(#+前缀+txtremaindamt );
如果(txtremaindamt。Val)( / ^ { 0-9 } + $ /)(= =。比赛为null){
TxtRemaindAmt.addClass(farevalidform );
抛出对不起,票的数量必须是数字!;
}
{其他
如果(txtremaindamt.val()<1){
TxtRemaindAmt.addClass(farevalidform );
抛出对不起,车票的数量必须超过0!;
}
}

无功txtfareprice = $(#+前缀+txtfareprice );
如果(txtfareprice。Val)( / ^ { 0-9 } + 0美元/(= =)。比赛null){
TxtFarePrice.addClass(farevalidform );
抛出对不起,票面价格必须是一个数字和倍数10!;
}
});

} catch(e){
PopupMsg(E);
返回false;
}

返回customconfirm(obj,你确定你想更新它吗);
}
{其他
PopupMsg(对不起,你没有修改任何项目!;
返回false;
}
}