1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- // 限制时间
- function getNextMonth(date) {
- var arr = date.split('/');
- var year = arr[0];
- var month = arr[1];
- var day = arr[2];
- var days = new Date(year, month, 0);
- days = days.getDate();
- var year2 = year;
- var month2 = parseInt(month) + 2;
- if (month2 > 13) {
- year2 = parseInt(year2) + 1;
- if (parseInt(month)==11) {
- month2 = 1;
- }else if (parseInt(month)==12) {
- month2 = 2;
- };
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if (day2 > days2) {
- day2 = days2;
- }
- if (month2 < 10) {
- month2 = '0' + month2;
- }
- var t2 = year2 + '/' + month2 + '/' + day2;
- return t2;
- }
- var myDate = new Date;
- var year = myDate.getFullYear();
- var yue = myDate.getMonth()+1;
- if (yue<10) {
- yue= '0' + yue;
- };
- var time = year+'/'+yue+'/01';
- var time_yxq= year+'/'+yue+'/01-'+getNextMonth(time);
- $('.w-commonality').html('(有效期:'+time_yxq+')'); //制限时间
- var randomX = 200;
- var randomY = 600;
- var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY);
- $('.w-close').html('已有<i>'+randvalue+'</i>关注')
|