js 設置默認時間


 

 

 

                            <td class="title95">計划生產日期</td>
                            <td>
                                <input id="BeginSch" name="BenginProdceDate" class="easyui-datebox filewidth_n" type="datetime" data-options="required:false,validType:['DateDay'],onSelect:function(){fullnum('BeginSch','EndSch')}">
                            </td>
                            <td align="center">至</td>
                            <td>
                                <input id="EndSch" name="EndProdceDate" class="easyui-datebox filewidth_n" style="width:150px" type="datetime" data-options="required:false,validType:['DateDay'],onSelect:function(){fullnum('BeginSch','EndSch')}">
                            </td> 


 SetSearchDay('BeginSch', 'EndSch', 1, 7)

//初始化設置查詢時間
//beginID:開始的Id名稱 
//EndID:結束的Id名稱 
//Type:1:向前,2向后
//SpanDays: 間隔天數
function SetSearchDay(BeginID, EndID, Type, SpanDays) { 
    var fdate ;
    var tdate ;
    if (Type == 1) {
        fdate = (new Date().getFullYear()) + "-" + (new Date().getMonth() + 1) + "-" + (new Date().getDate() );
        tdate = (new Date().getFullYear()) + "-" + (new Date().getMonth() + 1) + "-" + (new Date().getDate() + SpanDays);
    } else if (Type == 2) {
        fdate = (new Date().getFullYear()) + "-" + (new Date().getMonth() + 1) + "-" + (new Date().getDate() - SpanDays);
        tdate = (new Date().getFullYear()) + "-" + (new Date().getMonth() + 1) + "-" + (new Date().getDate());
    }

    $("#" + BeginID).datebox('setValue', fdate);
    $("#" + EndID).datebox('setValue', tdate);
}

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM