easyui dataBox 增加一天,减少一天

<table>
        <tr>
            <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="Previousday()">上一天</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="NextDay()">下一天</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="ToExcel()">报表输出</a>
            </td>
        </tr>
        <tr>
            <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="RunRanking()">计算排名</a>
            </td>
        </tr>
        <tr>
            <td>
                <input id="CreateDate" name="CreateDate" class="easyui-datebox"></input></td>
        </tr>
    </table>
<script>
    var CreateDate_Temp;
    $('#CreateDate').datebox({
        onSelect: function (date) {
            CreateDate_Temp = $('#CreateDate').datebox('getValue');
            Search();
        }
    });
    function Search() {
        if (CreateDate_Temp == "") {
            return;
        }
        $('#datagrid').datagrid({
            url: '@Url.Action("Index", "EveryDayPointReport")' + "?createDate=" + CreateDate_Temp
        });
    $('#datagrid').datagrid("fitColumns");

}
function Previousday() {

    var curDate = new Date(CreateDate_Temp);
    var preDate = new Date(curDate.getTime() - 24 * 60 * 60 * 1000);

    var strDate = preDate.getFullYear() + "-";
    strDate += preDate.getMonth() + 1 + "-";
    strDate += preDate.getDate() + "-";
    strDate += preDate.getHours() + ":";
    strDate += preDate.getMinutes() + ":";
    strDate += preDate.getSeconds();
    $("#CreateDate").datebox("setValue", strDate);
    CreateDate_Temp = $('#CreateDate').datebox('getValue');
    Search();
}
function NextDay() {

    // var nextDate = new Date(curDate.getTime() + 24*60*60*1000);
    var curDate = new Date(CreateDate_Temp);
    var nextDate = new Date(curDate.getTime() + 24 * 60 * 60 * 1000);

    var strDate = nextDate.getFullYear() + "-";
    strDate += nextDate.getMonth() + 1 + "-";
    strDate += nextDate.getDate() + "-";
    strDate += nextDate.getHours() + ":";
    strDate += nextDate.getMinutes() + ":";
    strDate += nextDate.getSeconds();
    $("#CreateDate").datebox("setValue", strDate);
    CreateDate_Temp = $('#CreateDate').datebox('getValue');
    Search();
}
$(document).ready(function () {
    $(function () {
        var curr_time = new Date();
        var strDate = curr_time.getFullYear() + "-";
        strDate += curr_time.getMonth() + 1 + "-";
        strDate += curr_time.getDate() + "-";
        strDate += curr_time.getHours() + ":";
        strDate += curr_time.getMinutes() + ":";
        strDate += curr_time.getSeconds();
        $("#CreateDate").datebox("setValue", strDate);
        CreateDate_Temp = $('#CreateDate').datebox('getValue'); Search();
    });
});

 

posted @ 2015-07-28 16:14  pengbg  阅读(1197)  评论(0编辑  收藏  举报