45aec00a216aca0b93ccde0fc7c8e6082ec528d1.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. %>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9. <title>日期</title>
  10. <!--框架必需start-->
  11. <script type="text/javascript" src="<%=path%>/libs/js/jquery.js"></script>
  12. <script type="text/javascript" src="<%=path%>/libs/js/language/cn.js"></script>
  13. <script type="text/javascript" src="<%=path%>/libs/js/framework.js"></script>
  14. <link href="<%=path%>/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  15. <link rel="stylesheet" type="text/css" id="skin" prePath="<%=path%>/"/>
  16. <link rel="stylesheet" type="text/css" id="customSkin"/>
  17. <!--框架必需end-->
  18. <!-- 日期选择框start -->
  19. <script type="text/javascript" src="<%=path%>/libs/js/form/datePicker/WdatePicker.js"></script>
  20. <!-- 日期选择框end -->
  21. </head>
  22. <body>
  23. <div class="box1" panelWidth="800">
  24. <fieldset>
  25. <legend>1、基本日期控件</legend>
  26. <input type="text" class="date"/>
  27. </fieldset>
  28. <div class="height_15"></div>
  29. <fieldset>
  30. <legend>2、选择日期+时间</legend>
  31. <input type="text" class="date" style="width:200px;" dateFmt="yyyy-MM-dd HH:mm:ss"/>
  32. </fieldset>
  33. <div class="height_15"></div>
  34. <fieldset>
  35. <legend>3、只选择时间</legend>
  36. <input type="text" class="date" dateFmt="HH:mm:ss"/>
  37. </fieldset>
  38. <div class="height_15"></div>
  39. <fieldset>
  40. <legend>4、自定义时间格式</legend>
  41. <input type="text" class="date" style="width:200px;" dateFmt="yyyy年MM月dd日HH时mm分ss秒"/>
  42. </fieldset>
  43. <div class="height_15"></div>
  44. <fieldset>
  45. <legend>5、日期控件默认有值</legend>
  46. <input type="text" class="date" value="2012-07-08"/>
  47. </fieldset>
  48. <div class="height_15"></div>
  49. <fieldset>
  50. <legend>6、动态生成日期控件</legend>
  51. <input type="button" value="点击生成日期控件" id="testBtn" onclick="createDate()"/>
  52. </fieldset>
  53. <div class="height_15"></div>
  54. <fieldset>
  55. <legend>7、日期控件动态赋值</legend>
  56. <input type="text" class="date" id="date-7"/>
  57. <input type="button" value="点击赋值" onclick="setValue()"/>
  58. </fieldset>
  59. <div class="height_15"></div>
  60. <fieldset>
  61. <legend>8、禁用/启用</legend>
  62. <input type="text" class="date" disabled="true" id="date-8"/>
  63. <br/>
  64. <input type="button" value="启用" onclick="enableSelect()" style="width:105px;"/>
  65. <input type="button" value="禁用" onclick="disableSelect()" style="width:105px;"/>
  66. </fieldset>
  67. <div class="height_15"></div>
  68. <fieldset>
  69. <legend>9、双日历</legend>
  70. <input class="date" type="text" doubleCal="true"/>
  71. </fieldset>
  72. <div class="height_15"></div>
  73. <fieldset>
  74. <legend>10、起止日期联动</legend>
  75. <input type="text" id="beginTime" class="dateIcon"/>
  76. <input type="text" id="endTime" class="dateIcon"/>
  77. </fieldset>
  78. <div class="height_15"></div>
  79. <fieldset>
  80. <legend>11、平面显示</legend>
  81. <div id="div1"></div>
  82. </fieldset>
  83. <div class="height_15"></div>
  84. <fieldset>
  85. <legend>12、选择今天之前</legend>
  86. <input class="dateIcon" type="text" onfocus="WdatePicker({skin:themeColor,maxDate:'%y-%M-%d'})"/>
  87. </fieldset>
  88. <div style="height:300px;"></div>
  89. </div>
  90. <script type="text/javascript">
  91. var dateSkin="blue";
  92. function initComplete(){
  93. //获取当前主题风格,用于设置日期控件的皮肤
  94. try {
  95. dateSkin=themeColor;
  96. }
  97. catch(e){}
  98. //自定义点击触发日期控件
  99. document.getElementById('beginTime').onfocus=function(){
  100. var endtimeTf=$dp.$('endTime');
  101. WdatePicker({
  102. skin:dateSkin,onpicked:function(){endtimeTf.focus();},maxDate:'#F{$dp.$D(\'endTime\')}'
  103. });
  104. }
  105. document.getElementById('endTime').onfocus=function(){
  106. //这里设置了最大日期为当前日期,如果不需要则把maxDate:'%y-%M-%d'去掉
  107. WdatePicker({skin:dateSkin,maxDate:'%y-%M-%d',minDate:'#F{$dp.$D(\'beginTime\')}'});
  108. }
  109. //平面显示
  110. WdatePicker({skin:dateSkin,eCont:'div1',onpicked:function(dp){alert('你选择的日期是:'+dp.cal.getDateStr())}})
  111. }
  112. //动态生成
  113. function createDate(){
  114. var $date=$('<input type="text" class="date" style="width:140px;" dateFmt="yyyy-MM-dd HH:mm:ss"/>');
  115. $("#testBtn").after($date);
  116. $date.render();
  117. }
  118. //设为不可用
  119. function disableSelect(){
  120. $("#date-8").attr("disabled",true);
  121. }
  122. //设为可用
  123. function enableSelect(){
  124. $("#date-8").attr("disabled",false);
  125. }
  126. //动态赋值
  127. function setValue(){
  128. $("#date-7").val("2012-07-08");
  129. }
  130. </script>
  131. </body>
  132. </html>