日期控件My97的时间限制

来源:互联网 发布:ubuntu gcc 版本 编辑:程序博客网 时间:2024/05/21 15:45

1.功能描述:根据单选框的选中状态,动态显示my97的显示格式,具体的格式限制在My97的事例中就有详细介绍

http://www.my97.net/dp/demo/resource/2.4.asp


index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">   
    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript" src="jquery.js"></script>


<script type="text/javascript">
 function demo() {
  var searchTimeRange=document.getElementById("searchTimetoday").checked;
    
     if(searchTimeRange){
      WdatePicker({skin:'whyGreen',dateFmt:'H:mm:ss',minDate:'00:00:00',maxDate:'23:59:59'});
    } else {
        WdatePicker({skin:'whyGreen',dateFmt:'yyyy-M-d H:mm:ss',maxDate:'%y-%M-{%d-1} 23:59:59'});
    }
  }
</script>

</head>
 
  <body>
     查询时间范围:<input id="searchTimetoday" name="searchTime" type="radio" value="0" checked />
     今天
        <input id="searchTimehistory" name="searchTime" type="radio" value="1" />
      历史
      选择时间:<input id="beginDate" name="beginDate" type="text" class="txt_input1 Wdate" onfocus="demo()"/>-
     <input id="endDate" name="endDate" type="text" class="txt_input1 Wdate" onfocus="demo()"/> 
   </body>
</html>