|
|
|
อยากได้ Function เช็ค วันที่ถ้ามันทับซ้อนกันให้เตือนอ่ะครับ Javascript |
|
|
|
|
|
|
|
Code (JavaScript)
for(a=0;a<count_sel;a++){
for(b=row;b>0;b--){
if(a!=b && b>a){
if($("#room_id"+a).val() == $("#room_id"+b).val()){
var travelling_from_sel = $("#travelling_from_sel"+a).val();
res = travelling_from_sel.split("/");
var travelling_from_sel=new Date();
travelling_from_sel.setFullYear(res[2],res[1],res[0]);
var travelling_to_sel = $("#travelling_to_sel"+a).val();
res2 = travelling_to_sel.split("/");
var travelling_to_sel=new Date();
travelling_to_sel.setFullYear(res2[2],res2[1],res2[0]);
var travelling_from_sel2 = $("#travelling_from_sel"+b).val();
res3 = travelling_from_sel2.split("/");
var travelling_from_sel2=new Date();
travelling_from_sel2.setFullYear(res3[2],res3[1],res3[0]);
var travelling_to_sel2 = $("#travelling_to_sel"+b).val();
res4 = travelling_to_sel2.split("/");
var travelling_to_sel2=new Date();
travelling_to_sel2.setFullYear(res4[2],res4[1],res4[0]);
if(travelling_from_sel >= travelling_from_sel2 && travelling_from_sel <= travelling_to_sel2 || travelling_to_sel >= travelling_from_sel2 && travelling_to_sel <= travelling_to_sel2 || travelling_from_sel2 >= travelling_from_sel && travelling_from_sel2 <= travelling_to_sel || travelling_to_sel2 >= travelling_from_sel && travelling_to_sel2 <= travelling_to_sel){
row1 = a+1;
row2 = b+1;
alert("Period Overlap Please Check \nAt Row : "+row1 +","+row2);
return false;
}
}
}
}
}
ใช้แบบนี้มันถูกต้องไหม๊ครับ
|
|
|
|
|
Date :
2015-03-26 10:46:00 |
By :
nut_ch31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|