intro.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // 限制时间
  2. function getNextMonth(date) {
  3. var arr = date.split('/');
  4. var year = arr[0];
  5. var month = arr[1];
  6. var day = arr[2];
  7. var days = new Date(year, month, 0);
  8. days = days.getDate();
  9. var year2 = year;
  10. var month2 = parseInt(month) + 2;
  11. if (month2 > 13) {
  12. year2 = parseInt(year2) + 1;
  13. if (parseInt(month)==11) {
  14. month2 = 1;
  15. }else if (parseInt(month)==12) {
  16. month2 = 2;
  17. };
  18. }
  19. var day2 = day;
  20. var days2 = new Date(year2, month2, 0);
  21. days2 = days2.getDate();
  22. if (day2 > days2) {
  23. day2 = days2;
  24. }
  25. if (month2 < 10) {
  26. month2 = '0' + month2;
  27. }
  28. var t2 = year2 + '/' + month2 + '/' + day2;
  29. return t2;
  30. }
  31. var myDate = new Date;
  32. var year = myDate.getFullYear();
  33. var yue = myDate.getMonth()+1;
  34. if (yue<10) {
  35. yue= '0' + yue;
  36. };
  37. var time = year+'/'+yue+'/01';
  38. var time_yxq= year+'/'+yue+'/01-'+getNextMonth(time);
  39. $('.w-commonality').html('(有效期:'+time_yxq+')'); //制限时间
  40. var randomX = 200;
  41. var randomY = 600;
  42. var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY);
  43. $('.w-close').html('已有<i>'+randvalue+'</i>关注')