123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>日历</title>
- <script src="/js/lib/jquery-1.9.1/jquery.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- nowd=nowdata;
- addMonth();
- // $.ajax({
- // url:""+baseConfig.URL.deptAdd,
- // type:"POST",
- // data:$("#iDeptAddForm").serialize(),
- // dataType:"json",
- // success:function (data) {
- // if (data.status == 'SUCCESS') {
- // alert("信息已经成功保存");
- // $("#iDeptAdd").dialog("close");
- // deptVM.getDataList();
- // }
- // },
- // complete:function (XHR, TS) {
- // // $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled");
- // },
- // error:function (XMLHttpRequest, textStatus, errorThrown) {
- // alert(textStatus);
- // }
- // });
- });
- var nowdata= new Date();
- var nowd;
- function addDate(dd,dadd){
- var a = (dd);
- a = a.valueOf();
- a = a + dadd * 24 * 60 * 60 * 1000;
- a = new Date(a);
- return a;
- }
- function addMonth() {
- $("#rltable").html('');
- $("#nownow").html(nowd.toLocaleString());
- var begindate=new Date(nowd);
- begindate.setDate(1);
- begindate=addDate(begindate,(0-begindate.getDay()));
- var enddate=new Date(nowd);
- enddate.setDate(1);
- enddate.setMonth(enddate.getMonth()+1);
- enddate=addDate(enddate,7-(enddate.getDay()));
- var str='';
- var i=1;
- while (begindate<enddate){
- if(str=="")str='<tr>';
- 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>';
- alert(str);
- if(i++%7==0)
- str+='</tr><tr>';
- begindate=addDate(begindate,1);
- }
- $("#rltable").append(str);
- }
- function addli(obj) {
- $("#"+obj).append('<br><input type="hidden" name="ks" value="'+obj+'"/><input name="vs"/>');
- }
- function perMonth() {
- nowd=nowdata;
- nowd.setMonth(nowd.getMonth()-1);
- addMonth();
- }
- function nowMonth() {
- nowd=nowdata;
- addMonth();
- }
- function nextMonth() {
- nowd=nowdata;
- nowd.setMonth(nowd.getMonth()+1);
- addMonth();
- }
- function savetitle() {
- $.ajax({
- url:"http://localhost:8080/rl/add",
- type:"POST",
- data:$("#tableForm").serialize(),
- dataType:"json",
- success:function (data) {
- if (data.status == 'SUCCESS') {
- }
- },
- complete:function (XHR, TS) {
- // $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled");
- },
- error:function (XMLHttpRequest, textStatus, errorThrown) {
- alert(textStatus);
- }
- });
- }
- </script>
- </head>
- <body>
- <a href="#" onclick="perMonth();">上月</a>
- <a href="#" onclick="nowMonth();">本月</a>
- <a href="#" onclick="nextMonth();">下月</a>
- <a href="#" onclick="savetitle();">save</a>
- <span id="nownow"></span>
- <form id="tableForm">
- <table style="border:solid 1px;width: 100%">
- <thead>
- <tr >
- <td>周 日
- </td>
- <td>周一
- </td>
- <td>周一
- </td>
- <td>周一
- </td>
- <td>周一
- </td>
- <td>周一
- </td>
- <td>周六
- </td>
- </tr>
- </thead>
- <tbody id="rltable" style="border:solid 1px;width: 100%">
- </tbody>
- </table>
- </form>
- </body>
- </html>
|