<body> <div class="page_content"> <div class="box_01 submitdata"> <div class="inner12px"> <div class="cell boxBmargin12"> <form name="myform" method="post" id="myform"> <input type="hidden" value="flag" name="flag"> <table> <tr> <th>开始日期</th> <td><input type="text" name="queryStartTime" style="width:150px;" dataType="*" msg="此项为必填" id="queryStartTime" class="Wdate" value="<fmt:formatDate pattern="yyyyMMdd" value="${queryStartTime}"/>" onclick="var dateFormat=changeTime();WdatePicker({dateFmt:dateFormat,maxDate:'#F{$dp.$D(\'queryEndTime\')}'})"> </td> <th>结束日期</th> <td><input type="text" name="queryEndTime" style="width:150px;" dataType="*" msg="此项为必填" id="queryEndTime" class="Wdate" value="<fmt:formatDate pattern="yyyyMMdd" value="${queryEndTime}"/>" onclick="var dateFormat=changeTime(); WdatePicker({dateFmt:dateFormat,maxDate:'#F{$dp.$D(\'queryStartTime\')}'})"> </td> <th>微信号</th> <td> <select id="selectWeiphone" style="width:150px;" name="weiPhoneNumTypeId"> <c:forEach items="${results }" var="result"> <option value="${result.id }">${result.noticeName}</option> </c:forEach> </select> </td> <th>查询维度</th> <td> <select id="selectTime" style="width:150px" name="selectTimeType" onchange="changeTime();"> <option value="0" selected>日</option> <option value="1" >月</option> <option value="2" >年</option> </select> </td> </tr> <tr> <td colspan="8"> <div class="btn_area_setc"> <a href="###" class="btn_01" onclick="search_data()">查询<b></b></a> <a href="###" class="btn_01" onclick="clear_form(document.myform);">清空<b></b></a> <a href="###" class="btn_01" onclick="excel();">导出<b></b></a> </div> </td> </tr> </table> </form> </div> <div id="pagination"></div> </div> </div> </div> </body>
function changeTime() { var dt=new Date(new Date().getTime()-1000*60*60*24); var year=dt.getFullYear(); var month=dt.getMonth()+1; if(month<10) { month='0'+month; } var day=dt.getDate(); if(day<10) { day='0'+day; } var dateFormat=''; var current; if($("#selectTime").find(":selected").val()==0) { dateFormat='yyyyMMdd'; current=year+""+month+""+day; }else if($("#selectTime").find(":selected").val()==1) { dateFormat='yyyyMM'; current=year+""+month; }else { dateFormat='yyyy'; current=year; } $("#queryStartTime").val(current); $("#queryEndTime").val(current); return dateFormat; }