首页 > Web开发 > 详细

js 上一天、下一天

时间:2015-08-21 12:49:57      阅读:234      评论:0      收藏:0      [点我收藏+]
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);
}
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);
}

<a href="javascript:void(0)" class="easyui-linkbutton" onclick="Previousday()">上一天</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="NextDay()">下一天</a>

 <input id="CreateDate" name="CreateDate" class="easyui-datebox"></input>

js 上一天、下一天

原文:http://www.cnblogs.com/bingguang/p/4747215.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!