我正在尝试从switch语句中添加多个值(值,breakMonValue,finishMonValue,并能够对这些添加在一起的值进行控制台日志,我想知道这是否可能吗?
请忽略: 看起来您的帖子大部分是代码;请添加更多详细信息。 看起来您的帖子大部分是代码;请添加更多详细信息。 看起来您的帖子大部分是代码;请添加更多详细信息。 看起来您的帖子大部分是代码;请添加更多详细信息。
它们是这样布置的
$('.start-time-monday').each(function(){
$(this).change(function(){
var monTime = $('.start-time-monday option:selected').text();
var value = 0;
switch(monTime){
case "7:00 am":
value = 7.00;
break;
case "7:15 am":
value = 7.25;
break;
case "7:30 am":
value = 7.50;
break;
case "7:45 am":
value = 7.75;
break;
case "8:00 am":
value = 8.00;
break;
case "8:15 am":
value = 8.25;
break;
case "8:30 am":
value = 8.50;
break;
case "8:45 am":
value = 8.75;
break;
case "9:00 am":
value = 9.00;
break;
case "9:15 am":
value = 9.25;
break;
case "9:30 am":
value = 9.50;
break;
case "9:45 am":
value = 9.75;
break;
case "10:00 am":
value = 10.00;
break;
case "10:15 am":
value = 10.25;
break;
case "10:30 am":
value = 10.50;
break;
case "10:45 am":
value = 10.75;
break;
case "11:00 am":
value = 11.00;
break;
case "11:15 am":
value = 11.25;
break;
case "11:30 am":
value = 11.50;
break;
case "11:45 am":
value = 11.75;
break;
case "12:00 pm":
value = 12.00;
break;
case "12:15 pm":
value = 12.25;
break;
case "12:30 pm":
value = 12.50;
break;
case "12:45 pm":
value = 12.75;
break;
case "1:00 pm":
value = 13.00;
break;
case "1:15 pm":
value = 13.25;
break;
case "1:30 pm":
value = 13.50;
break;
case "1:45 pm":
vaue = 13.75;
break;
case "2:00 pm":
value = 14.00;
break;
case "2:15 pm":
value = 14.25;
break;
case "2:30 pm":
value = 14.50;
break;
case "2:45 pm":
value = 14.75;
break;
case "3:00 pm":
value = 15.00;
break;
case "3:15 pm":
value = 15.25;
break;
case "3:30 pm":
value = 15.50;
break;
case "3:45 pm":
value = 15.75;
break;
case "4:00 pm":
value = 16.00;
break;
case "4:15 pm":
value = 16.25;
break;
case "4:30 pm":
value = 16.50;
break;
case "4:45 pm":
value = 16.75;
break;
case "5:00 pm":
value = 17.00;
break;
case "5:15 pm":
value = 17.25;
break;
case "5:30 pm":
value = 17.50;
break;
case "5:45 pm":
value = 17.75;
break;
case "6:00 pm":
value = 18.00;
break;
case "6:15 pm":
value = 18.25;
break;
case "6:30 pm":
value = 18.50;
break;
case "6:45 pm":
value = 18.75;
break;
case "7:00 pm":
value = 19.00;
break;
case "7:15 pm":
value = 19.25;
break;
case "7:30 pm":
value = 19.50;
break;
case "7:45 pm":
value = 19.75;
break;
default:
value = '0';
break;
}
//var startTimeMon = timeSwitch(monTime) ;
console.log(value, 'Monday Start time value');
});
});
$('.meal-break-monday').each(function(){
$(this).change(function(){
var breakMonTime = $('.meal-break-monday option:selected').text();
var breakMonvalue = "";
switch(breakMonTime){
case "15 mins":
breakMonvalue = 0.25;
break;
case "30 mins":
breakMonvalue = 0.50;
break;
case "45 mins":
breakMonvalue = 0.75;
break;
case "60 mins":
breakMonvalue = 1.00;
break;
default:
value = '0';
break;
}
//var startTimeMon = timeSwitch(monTime) ;
console.log(breakMonvalue, 'Mon BREAK time value');
});
});
//finish time monday
$('.finish-time-monday').each(function(){
$(this).change(function(){
var finishMonTime = $('.finish-time-monday option:selected').text();
var finishMonvalue = "";
switch(finishMonTime){
case "7:00 am":
finishMonvalue = 7.00;
break;
case "7:15 am":
finishMonvalue = 7.25;
break;
case "7:30 am":
finishMonvalue = 7.50;
break;
case "7:45 am":
finishMonvalue = 7.75;
break;
case "8:00 am":
finishMonvalue = 8.00;
break;
case "8:15 am":
finishMonvalue = 8.25;
break;
case "8:30 am":
finishMonvalue = 8.50;
break;
case "8:45 am":
finishMonvalue = 8.75;
break;
case "9:00 am":
finishMonvalue = 9.00;
break;
case "9:15 am":
finishMonvalue = 9.25;
break;
case "9:30 am":
finishMonvalue = 9.50;
break;
case "9:45 am":
finishMonvalue = 9.75;
break;
case "10:00 am":
finishMonvalue = 10.00;
break;
case "10:15 am":
finishMonvalue = 10.25;
break;
case "10:30 am":
finishMonvalue = 10.50;
break;
case "10:45 am":
finishMonvalue = 10.75;
break;
case "11:00 am":
finishMonvalue = 11.00;
break;
case "11:15 am":
finishMonvalue = 11.25;
break;
case "11:30 am":
finishMonvalue = 11.50;
break;
case "11:45 am":
finishMonvalue = 11.75;
break;
case "12:00 pm":
finishMonvalue = 12.00;
break;
case "12:15 pm":
finishMonvalue = 12.25;
break;
case "12:30 pm":
finishMonvalue = 12.50;
break;
case "12:45 pm":
finishMonvalue = 12.75;
break;
case "1:00 pm":
finishMonvalue = 13.00;
break;
case "1:15 pm":
finishMonvalue = 13.25;
break;
case "1:30 pm":
finishMonvalue = 13.50;
break;
case "1:45 pm":
finishMonvaue = 13.75;
break;
case "2:00 pm":
finishMonvalue = 14.00;
break;
case "2:15 pm":
finishMonvalue = 14.25;
break;
case "2:30 pm":
finishMonvalue = 14.50;
break;
case "2:45 pm":
finishMonvalue = 14.75;
break;
case "3:00 pm":
finishMonvalue = 15.00;
break;
case "3:15 pm":
finishMonvalue = 15.25;
break;
case "3:30 pm":
finishMonvalue = 15.50;
break;
case "3:45 pm":
finishMonvalue = 15.75;
break;
case "4:00 pm":
finishMonvalue = 16.00;
break;
case "4:15 pm":
finishMonvalue = 16.25;
break;
case "4:30 pm":
finishMonvalue = 16.50;
break;
case "4:45 pm":
finishMonvalue = 16.75;
break;
case "5:00 pm":
finishMonvalue = 17.00;
break;
case "5:15 pm":
finishMonvalue = 17.25;
break;
case "5:30 pm":
finishMonvalue = 17.50;
break;
case "5:45 pm":
finishMonvalue = 17.75;
break;
case "6:00 pm":
finishMonvalue = 18.00;
break;
case "6:15 pm":
finishMonvalue = 18.25;
break;
case "6:30 pm":
finishMonvalue = 18.50;
break;
case "6:45 pm":
finishMonvalue = 18.75;
break;
case "7:00 pm":
finishMonvalue = 19.00;
break;
case "7:15 pm":
finishMonvalue = 19.25;
break;
case "7:30 pm":
finishMonvalue = 19.50;
break;
case "7:45 pm":
value = 19.75;
break;
default:
value = '0';
break;
}
//var startTimeMon = timeSwitch(monTime) ;
console.log(finishMonvalue, 'Mon FINISH time value');
});
});