jsp里input中獲取當前時間,與WdatePicker配合使用


<script language="javascript" type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>

<script type="text/javascript">

<%  
          java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
          java.util.Date currentTime = new java.util.Date();//得到當前系統時間
          String str_date = formatter.format(currentTime); //將日期時間格式化 
 %> 

if($.trim($("#begintime_id").val())!="")
{
      if($.trim($("#endtime_id").val())=="")
      {
            alert("結束時間不允許為空!");
            return;
      }
}
if($.trim($("#endtime_id").val())!="")
{
      if($.trim($("#begintime_id").val())=="")
      {
            alert("開始時間不允許為空!");
            return;
      }
}

</script>

<input id="begintime_id" name="begintime" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endtime_id\')}'})" readonly="readonly" value="<%=str_date%>" class="Wdate" Style="{width:86px}"/>

 

<input id="endtime_id" name="endtime" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'begintime_id\')}'})" readonly="readonly" type="text" value="<%=str_date%>" class="Wdate" Style="{width:86px}"/>

 

 


免責聲明!

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



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