读书人

一个礼拜中某一天存在即显示的思路

发布时间: 2012-10-29 10:03:53 作者: rapoo

一个星期中某一天存在即显示的思路

1、
一个礼拜中某一天存在即显示的思路

days:? 1,2,3,4,5,6,0???? //数据库中的每条数据对应一条记录
???? ?? 或1,2,3,4,0
??????? 或5,6
???? ? ? ...

?

?

?

function saveOrUpdateWeek(){var daysStr = "";var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];for (var i=0; i<days.length; i++) {if (jQuery("#"+days[i]).attr("checked") == true) {   daysStr += i+",";}}daysStr = daysStr.substring(0,daysStr.length-1);jQuery("#dayOfWeek").val(daysStr);}function initDayOfWeek(str){jQuery("input[type='checkbox']").attr("checked",false);var days = str.split(",");if(days.length == 7) {jQuery("#idAllWeek").attr("checked",true);}else{jQuery("#idAllWeek").attr("checked",false);}for(var i =0;i<days.length;i++){switch (days[i]) {case '0': jQuery('#sun').attr("checked",true); break;case '1': jQuery('#mon').attr("checked",true); break;case '2': jQuery('#tue').attr("checked",true); break;case '3': jQuery('#wed').attr("checked",true); break;case '4': jQuery('#thu').attr("checked",true); break;case '5': jQuery('#fri').attr("checked",true); break;case '6': jQuery('#sat').attr("checked",true); break;}}}function checkAllWeekStatus( chkObj ) {if ( chkObj.checked ) { jQuery('#mon').attr("checked",true);jQuery('#tue').attr("checked",true);jQuery('#wed').attr("checked",true);jQuery('#thu').attr("checked",true);jQuery('#fri').attr("checked",true);jQuery('#sat').attr("checked",true);jQuery('#sun').attr("checked",true);} else {jQuery('#mon').attr("checked",false);jQuery('#tue').attr("checked",false);jQuery('#wed').attr("checked",false);jQuery('#thu').attr("checked",false);jQuery('#fri').attr("checked",false);jQuery('#sat').attr("checked",false);jQuery('#sun').attr("checked",false);}}
?

。。。。。。。

?

?

?

读书人网 >编程

热点推荐