laydate控件非常简单易用,只需要调用一个个函数就可以轻松实现日期时间选择。
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + "/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head> <body>
<form action="index.jsp" method="post">
<input type="text" id="xxx" name="xxx" onclick="laydate()" />
</form>
</body>
</html>
效果如如下:
项目结构(实际上就是将laydate包放入js目录下即可):