日期:2014-05-16 浏览次数:20336 次
//一个月里的天数
function m_DaysInMonth(pYear,pMonth){
??? var nDays = 30;
??? if(pMonth==2){??? //2月单独处理
??????? if(mIsLeap(pYear)) nDays = 29;
??????? else nDays = 28;
??? }
??? else if(mInList(pMonth,"1,3,5,7,8,10,12")){
??????? nDays = 31;???
??? }
??? return nDays;
}
//判断某年是否是闰年
function m_IsLeap(pYear){
??? if(pYear % 400 == 0){
??????? return true;
??? }
??? else if((pYear % 100 != 0) && (pYear % 4 == 0)){
??????? return true;
??? }
??? return false;
}
//判断是否在字符串列表里:
// if(mInList("3","1,3,5,7,8,10,12")){?? //true
// if(mInList("2","1,3,5,7,8,10,12")){?? //false
function mInList(s1,slist){
?? var ss1=","+s1+",";
?? var ss2=","+slist+",";
?? ss1 = ss1.toLowerCase();
?? ss2 = ss2.toLowerCase();
?? return ss2.indexOf(ss1)!=-1;
}
转自:http://weichaozu.blog.163.com/blog/static/123192959200962853711/