e35cf5ad0c669b9db0f5e8cbceb3caa8fc98816b.svn-base 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. </head>
  19. <body>
  20. <div class="box1" panelWidth="800">
  21. <fieldset>
  22. <legend>1、基本文本框</legend>
  23. <table class="tableStyle" formMode="transparent">
  24. <tr>
  25. <td width="10%">姓名:</td><td width="40%"><input type="text"/></td>
  26. <td width="10%">密码:</td><td width="40%"><input type="password"/></td>
  27. </tr>
  28. </table>
  29. </fieldset>
  30. <div class="height_15"></div>
  31. <fieldset>
  32. <legend>2、自定义宽度</legend>
  33. <table class="tableStyle" formMode="transparent">
  34. <tr>
  35. <td width="10%">曾用名:</td><td colspan="3"><input type="text" style="width:300px;" /></td>
  36. </tr>
  37. </table>
  38. </fieldset>
  39. <div class="height_15"></div>
  40. <fieldset>
  41. <legend>3、显示水印</legend>
  42. <table class="tableStyle" formMode="transparent">
  43. <tr>
  44. <td width="10%">用户名:</td><td colspan="3"><input type="text" watermark="输入字母或数字"/></td>
  45. </tr>
  46. </table>
  47. <div class="height_10"></div>
  48. 注意:当文本框启用了水印并且无输入时,那么在提交表单时使用表单的onsubmit事件会导致文本框的value值不为空。
  49. <br/>解决办法详见开发手册中的对应的章节。
  50. </fieldset>
  51. <div class="height_15"></div>
  52. <fieldset>
  53. <legend>4、可清除内容</legend>
  54. <table class="tableStyle" formMode="transparent">
  55. <tr>
  56. <td width="10%">姓名:</td><td width="40%"><input type="text" clearable="true"/></td>
  57. <td width="10%">密码:</td><td width="40%"><input type="password" clearable="true"/></td>
  58. </tr>
  59. </table>
  60. </fieldset>
  61. <div class="height_15"></div>
  62. <fieldset>
  63. <legend>5、限制输入字数</legend>
  64. <p>限制输入个数的基本做法是使用maxlength。效果如下:</p>
  65. <table class="tableStyle" formMode="transparent">
  66. <tr>
  67. <td width="10%">姓名:</td><td width="40%"><input type="text" maxlength="6"/></td>
  68. <td width="10%">密码:</td><td width="40%"><input type="password" maxlength="6"/></td>
  69. </tr>
  70. </table>
  71. <br/>
  72. <p>如果想显示还剩余多少字,使用maxNum。效果如下:</p>
  73. <table class="tableStyle" formMode="transparent">
  74. <tr>
  75. <td width="10%">姓名:</td><td width="40%"><input type="text" maxNum="6"/></td>
  76. <td width="10%">密码:</td><td width="40%"><input type="password" maxNum="6"/></td>
  77. </tr>
  78. </table>
  79. </fieldset>
  80. <div class="height_15"></div>
  81. <fieldset>
  82. <legend>6、限制输入类型</legend>
  83. <table class="tableStyle" formMode="transparent">
  84. <tr>
  85. <td width="10%">示例1:</td><td colspan="3"><input type="text" style="width:200px;" inputMode="numberOnly" watermark="限制输入正整数"/></td>
  86. </tr>
  87. <tr>
  88. <td width="10%">示例2:</td><td colspan="3"><input type="text" style="width:200px;" inputMode="positiveDecimal" watermark="限制输入非负整数或小数"/></td>
  89. </tr>
  90. </table>
  91. </fieldset>
  92. <div class="height_15"></div>
  93. <fieldset>
  94. <legend>7、密码框默认自动监测Caps键(此功能可关闭)</legend>
  95. <table class="tableStyle" formMode="transparent">
  96. <tr>
  97. <td width="10%">密码:</td><td colspan="3"><input type="password"/>(打开大写键后进行输入)</td>
  98. </tr>
  99. </table>
  100. </fieldset>
  101. <div class="height_15"></div>
  102. <fieldset>
  103. <legend>8、显示密码强度</legend>
  104. <table class="tableStyle" formMode="transparent">
  105. <tr>
  106. <td width="10%">密码:</td><td colspan="3"><input type="password" checkStrength="true"/></td>
  107. </tr>
  108. </table>
  109. 表单验证组件自带了密码强度检测,所以如果使用使用了表单验证,不需要开启此功能。
  110. </fieldset>
  111. <div class="height_15"></div>
  112. <fieldset>
  113. <legend>9、密码框设置初始值</legend>
  114. <table class="tableStyle" formMode="transparent">
  115. <tr>
  116. <td width="10%">密码:</td><td colspan="3"><input type="password" value="123456"/></td>
  117. </tr>
  118. </table>
  119. </fieldset>
  120. <div class="height_15"></div>
  121. <fieldset>
  122. <legend>10、禁用/启用</legend>
  123. <table class="tableStyle" formMode="transparent">
  124. <tr>
  125. <td width="10%">姓名:</td><td width="40%"><input type="text" id="input-10-1" disabled="true"/></td>
  126. <td width="10%">密码:</td><td width="40%"><input type="password" id="input-10-2" disabled="true"/></td>
  127. </tr>
  128. <tr>
  129. <td colspan="4">
  130. <input type="button" value="启用" onclick="enableSelect()" style="width:105px;"/>
  131. <input type="button" value="禁用" onclick="disableSelect()" style="width:105px;"/>
  132. </td>
  133. </tr>
  134. </table>
  135. </fieldset>
  136. <div class="height_15"></div>
  137. <fieldset>
  138. <legend>11、动态生成</legend>
  139. <input type="button" value="点击生成文本框" id="testBtn"/><br/><br/>
  140. <input type="button" value="点击生成密码框" id="testBtn2"/>
  141. <div class="height_10"></div>
  142. </fieldset>
  143. <div class="height_15"></div>
  144. <fieldset>
  145. <legend>12、监听回车事件</legend>
  146. 在文本框中输入后按回车会切换到密码框。密码框输入后按回车来进行登录处理。
  147. <table class="tableStyle" formMode="transparent" style="width:340px;">
  148. <tr>
  149. <td width="20%">姓名:</td><td width="80%"><input type="text" id="input-12-1"/></td>
  150. </tr>
  151. <tr>
  152. <td>密码:</td><td><input type="password" id="input-12-2"/></td>
  153. </tr>
  154. <tr>
  155. <td colspan="2"><input type="button" value="登录" style="width:105px;"/>&nbsp;&nbsp;<input type="reset" value="重置" style="width:105px;"/></td>
  156. </tr>
  157. </table>
  158. </fieldset>
  159. <div class="height_15"></div>
  160. <fieldset>
  161. <legend>13、浏览器原始文本框</legend>
  162. <table class="tableStyle" formMode="transparent">
  163. <tr>
  164. <td width="10%">姓名:</td><td colspan="3"><input type="text" keepDefaultStyle="true"/></td>
  165. </tr>
  166. </table>
  167. </fieldset>
  168. </div>
  169. <script type="text/javascript">
  170. //动态生成文本框
  171. $(function(){
  172. $("#testBtn").click(function(){
  173. var $input=$('<input type="text" watermark="输入字母或数字">');
  174. $(this).after($input);
  175. $input.render();
  176. })
  177. $("#testBtn2").click(function(){
  178. var $pass=$('<input type="password" checkStrength="true">');
  179. $(this).after($pass);
  180. $pass.render();
  181. })
  182. $("#input-12-1").bind("enter",function(){
  183. $("#input-12-2").focus();
  184. })
  185. $("#input-12-2").bind("enter",function(){
  186. top.Dialog.alert("进行提交处理");
  187. })
  188. })
  189. //设为不可用
  190. function disableSelect(){
  191. $("#input-10-1").attr("disabled",true);
  192. $("#input-10-2").attr("disabled",true);
  193. }
  194. //设为可用
  195. function enableSelect(){
  196. $("#input-10-1").attr("disabled",false);
  197. $("#input-10-2").attr("disabled",false);
  198. }
  199. </script>
  200. </body>
  201. </html>