<script type="text/javascript"> //日期加上天数后的新日期. function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate()+ AddDayCount); //获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1; //获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + "-" + d; } function bglxselect(obj) { var val = obj.value; var mydate = new Date(); var datenow = mydate.getFullYear() + "-" + parseInt(mydate.getMonth() + 1) + "-" + mydate.getDate(); var datemonth = mydate.getFullYear() + "-" + parseInt(mydate.getMonth() + 1) + "-01"; var dateyear = mydate.getFullYear() + "-01-01"; if (val == ‘day‘) { $("#rq1,#rq2").val(datenow) } if (val == ‘week‘) { var myday =parseInt(mydate.getDay()); if (myday == 0) { dateweek = GetDateStr(-6) } else { myday = myday-1 dateweek = GetDateStr(-myday) } $("#rq1").val(dateweek); $("#rq2").val(datenow); } if (val == ‘month‘) { $("#rq1").val(datemonth); $("#rq2").val(datenow); } if (val == ‘year‘) { $("#rq1").val(dateyear); $("#rq2").val(datenow); } editform.action = "gzbg_tj.asp"; editform.submit(); }
时间: 2024-11-10 13:46:51