rl.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>日历</title>
  6. <script src="/js/lib/jquery-1.9.1/jquery.min.js"></script>
  7. <script type="text/javascript">
  8. $(document).ready(function(){
  9. nowd=nowdata;
  10. addMonth();
  11. // $.ajax({
  12. // url:""+baseConfig.URL.deptAdd,
  13. // type:"POST",
  14. // data:$("#iDeptAddForm").serialize(),
  15. // dataType:"json",
  16. // success:function (data) {
  17. // if (data.status == 'SUCCESS') {
  18. // alert("信息已经成功保存");
  19. // $("#iDeptAdd").dialog("close");
  20. // deptVM.getDataList();
  21. // }
  22. // },
  23. // complete:function (XHR, TS) {
  24. // // $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled");
  25. // },
  26. // error:function (XMLHttpRequest, textStatus, errorThrown) {
  27. // alert(textStatus);
  28. // }
  29. // });
  30. });
  31. var nowdata= new Date();
  32. var nowd;
  33. function addDate(dd,dadd){
  34. var a = (dd);
  35. a = a.valueOf();
  36. a = a + dadd * 24 * 60 * 60 * 1000;
  37. a = new Date(a);
  38. return a;
  39. }
  40. function addMonth() {
  41. $("#rltable").html('');
  42. $("#nownow").html(nowd.toLocaleString());
  43. var begindate=new Date(nowd);
  44. begindate.setDate(1);
  45. begindate=addDate(begindate,(0-begindate.getDay()));
  46. var enddate=new Date(nowd);
  47. enddate.setDate(1);
  48. enddate.setMonth(enddate.getMonth()+1);
  49. enddate=addDate(enddate,7-(enddate.getDay()));
  50. var str='';
  51. var i=1;
  52. while (begindate<enddate){
  53. if(str=="")str='<tr>';
  54. str+='<td>'+begindate.getDate()+'<a href="#" onclick="addli('+"'"+begindate.getFullYear()+'-'+begindate.getMonth()+'-'+begindate.getDate()+"'"+');">+</a><div id="'+begindate.getFullYear()+'-'+begindate.getMonth()+'-'+begindate.getDate()+'"></div></td>';
  55. alert(str);
  56. if(i++%7==0)
  57. str+='</tr><tr>';
  58. begindate=addDate(begindate,1);
  59. }
  60. $("#rltable").append(str);
  61. }
  62. function addli(obj) {
  63. $("#"+obj).append('<br><input type="hidden" name="ks" value="'+obj+'"/><input name="vs"/>');
  64. }
  65. function perMonth() {
  66. nowd=nowdata;
  67. nowd.setMonth(nowd.getMonth()-1);
  68. addMonth();
  69. }
  70. function nowMonth() {
  71. nowd=nowdata;
  72. addMonth();
  73. }
  74. function nextMonth() {
  75. nowd=nowdata;
  76. nowd.setMonth(nowd.getMonth()+1);
  77. addMonth();
  78. }
  79. function savetitle() {
  80. $.ajax({
  81. url:"http://localhost:8080/rl/add",
  82. type:"POST",
  83. data:$("#tableForm").serialize(),
  84. dataType:"json",
  85. success:function (data) {
  86. if (data.status == 'SUCCESS') {
  87. }
  88. },
  89. complete:function (XHR, TS) {
  90. // $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled");
  91. },
  92. error:function (XMLHttpRequest, textStatus, errorThrown) {
  93. alert(textStatus);
  94. }
  95. });
  96. }
  97. </script>
  98. </head>
  99. <body>
  100. <a href="#" onclick="perMonth();">上月</a>
  101. <a href="#" onclick="nowMonth();">本月</a>
  102. <a href="#" onclick="nextMonth();">下月</a>
  103. <a href="#" onclick="savetitle();">save</a>
  104. <span id="nownow"></span>
  105. <form id="tableForm">
  106. <table style="border:solid 1px;width: 100%">
  107. <thead>
  108. <tr >
  109. <td>周 日
  110. </td>
  111. <td>周一
  112. </td>
  113. <td>周一
  114. </td>
  115. <td>周一
  116. </td>
  117. <td>周一
  118. </td>
  119. <td>周一
  120. </td>
  121. <td>周六
  122. </td>
  123. </tr>
  124. </thead>
  125. <tbody id="rltable" style="border:solid 1px;width: 100%">
  126. </tbody>
  127. </table>
  128. </form>
  129. </body>
  130. </html>