3cbec3b88bf0a738700ee7d982c634ee6cc7967c.svn-base 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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/keypad.js"></script>
  20. <!-- 软键盘控件end -->
  21. </head>
  22. <body>
  23. <div class="box1" panelWidth="800">
  24. <fieldset>
  25. <legend>1、数字键盘</legend>
  26. <input class="keypad" type="text" id="keypad-1"/>
  27. <input type="button" value="获取值" onclick="getValue()"/>
  28. </fieldset>
  29. <div class="height_15"></div>
  30. <fieldset>
  31. <legend>2、数字位置随机</legend>
  32. <input class="keypad" type="text" random="true"/>
  33. </fieldset>
  34. <div class="height_15"></div>
  35. <fieldset>
  36. <legend>3、允许输入</legend>
  37. <input type="password" class="keypad" random="true" allowKeyboard="true" inputMode="numberOnly" maxlength="6"/>
  38. <p> 这里模拟了密码输入:非明文显示、数字随机、可关闭后用键盘输入、只能输入数字、最多输入6位、大写键开启后输入有提示</p>
  39. </fieldset>
  40. <div class="height_15"></div>
  41. <fieldset>
  42. <legend>4、全键盘</legend>
  43. <input class="keypad" keypadMode="full" type="text"/>
  44. </fieldset>
  45. <div class="height_15"></div>
  46. <fieldset>
  47. <legend>5、全键盘允许输入</legend>
  48. <input type="text" class="keypad" keypadMode="full" allowKeyboard="true" />
  49. </fieldset>
  50. <div class="height_15"></div>
  51. <fieldset>
  52. <legend>6、禁用/启用</legend>
  53. <input class="keypad" type="text" disabled="true" id="keypad-6"/>
  54. <br/>
  55. <input type="button" value="启用" onclick="enableSelect()" style="width:105px;"/>
  56. <input type="button" value="禁用" onclick="disableSelect()" style="width:105px;"/>
  57. </fieldset>
  58. <div class="height_15"></div>
  59. <fieldset>
  60. <legend>7、动态创建数字键盘</legend>
  61. <input type="button" value="点击生成" id="testBtn" onclick="dynamic1()"/>
  62. </fieldset>
  63. <div class="height_15"></div>
  64. <fieldset>
  65. <legend>8、动态创建全键盘</legend>
  66. <input type="button" value="点击生成" id="testBtn2" onclick="dynamic2()"/>
  67. </fieldset>
  68. <div class="height_15"></div>
  69. </div>
  70. <script type="text/javascript">
  71. //获取值
  72. function getValue(){
  73. top.Dialog.alert($("#keypad-1").val());
  74. }
  75. //设为不可用
  76. function disableSelect(){
  77. $("#keypad-6").attr("disabled",true);
  78. }
  79. //设为可用
  80. function enableSelect(){
  81. $("#keypad-6").attr("disabled",false);
  82. }
  83. //动态生成
  84. function dynamic1(){
  85. var $keypad = $('<input type="text" class="keypad" random="true"/>');
  86. $("#testBtn").after($keypad);
  87. $("#testBtn").after($("<br/>"));
  88. //渲染
  89. $keypad.render();
  90. }
  91. //动态生成
  92. function dynamic2(){
  93. var $input = $('<input type="text" class="keypad" keypadMode="full"/>');
  94. $("#testBtn2").after($input);
  95. $("#testBtn2").after($("<br/>"));
  96. //渲染
  97. $input.render();
  98. }
  99. </script>
  100. </body>
  101. </html>