awtSearch.jsp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ page language="java" %>
  3. <html>
  4. <head>
  5. <style>
  6. BODY {
  7. scrollbar-face-color: #ffffff;
  8. scrollbar-highlight-color: #e0e0e0;
  9. scrollbar-3dlight-color: #ffffff;
  10. scrollbar-shadow-color: #e0e0e0;
  11. scrollbar-darkshadow-color: #ffffff;
  12. scrollbar-track-color: #ffffff;
  13. scrollbar-arrow-color: #919191;
  14. margin-left: 0px;
  15. margin-top: 0px;
  16. }
  17. TD { FONT-SIZE:12px; COLOR:#686868; FONT-FAMILY:돋움,Arial ; line-height: 16px; align:left; }
  18. select, input, textarea {color:#404040; font-family:돋움; font-size:12px; padding-top:2; line-height:16px }
  19. </style>
  20. <script language="javascript" src="../js/awtAjax.js"></script>
  21. <script language="javascript">
  22. var AwtTFMain = null;
  23. var AwtMode = null;
  24. function AwtSearchOne(AwtAjaxUrl, sendWord) {
  25. AwtMode = "matchone";
  26. xmlHttpPost();
  27. send(AwtAjaxUrl, sendWord, AwtMode);
  28. }
  29. function AwtSearchLike(AwtAjaxUrl, sendWord)
  30. {
  31. AwtMode = "autocomplete";
  32. frmSearch.sword.value = sendWord;
  33. xmlHttpPost();
  34. send(AwtAjaxUrl, sendWord, AwtMode);
  35. }
  36. function OnResult(strVal)
  37. {
  38. nCurrent=0;
  39. strVal = strVal.replace(/\r\n/g,"");
  40. if(AwtMode=="matchone")
  41. {
  42. AwtResult = strVal;
  43. if (AwtTFMain != null) {
  44. if (AwtResult.length != 0 && AwtResult != "null") {
  45. AwtTFMain.parent.window.javascript.AwtSetResult(AwtResult, AwtMode);
  46. }
  47. } else {
  48. //alert("'AwtBrowser::DocumentComplete'(Init 함수)가 호출되지 않았습니다.");
  49. }
  50. }
  51. else if(AwtMode=="autocomplete")
  52. {
  53. for (var i = parseInt(document.all.cnt.value) - 1; i >= 0 ; i--) {
  54. AwtListTable.deleteRow(i);
  55. }
  56. var tblCnts = "";
  57. if(strVal.length>0 && strVal.indexOf("■■■")>=0)
  58. {
  59. var strArr = strVal.split("■■■");
  60. document.all.cnt.value = strArr.length - 1;
  61. for (var i = 0; i < strArr.length; i++) {
  62. if (strArr[i] != '') {
  63. var strCol = strArr[i].split("□□□");
  64. var strData = strCol[0];
  65. var strShow = strCol[1];
  66. var row = AwtListTable.insertRow();
  67. var col = row.insertCell();
  68. col.height = 18;
  69. col.width = 12;
  70. col.setAttribute("id", "id_1_" + i);
  71. col.setAttribute("seq", i);
  72. if (i == 0)
  73. col.innerHTML = "<input type='radio' name='nm_1rdo' id='id_1rdo_" + i + "' checked/>";
  74. else
  75. col.innerHTML = "<input type='radio' name='nm_1rdo' id='id_1rdo_" + i + "'/>";
  76. col.onkeydown = function () {if (event.keyCode == 32 || event.keyCode == 13) {event.keyCode = 0;setResult();return;} if (event.keyCode == 27) hideThis();}
  77. col = row.insertCell();
  78. col.setAttribute("id", "id_2_" + i);
  79. col.setAttribute("data", strData);
  80. col.setAttribute("seq", i);
  81. col.innerHTML = strShow;
  82. col.onclick = function () {var a = document.getElementById('id_1rdo_' + this.seq); a.checked = true; setResult();}
  83. col.style.cssText ="FONT-SIZE:12px; border:1px solid #d8d8d8; COLOR:#000000; FONT-FAMILY:돋움,Arial ; align:left; ";
  84. col.innerHTML = strShow;
  85. }
  86. }
  87. if (AwtTFMain != null)
  88. AwtTFMain.parent.window.javascript.AwtShow();
  89. else {
  90. //alert("'AwtBrowser::DocumentComplete'(Init 함수)가 호출되지 않았습니다.");
  91. }
  92. }
  93. }
  94. }
  95. function focus() {
  96. frmSearch.sword.focus();
  97. }
  98. function setWordMouse()
  99. {
  100. setResult();
  101. }
  102. function setWordKey()
  103. {
  104. if (event.keyCode == 27 || event.keyCode == 13) {
  105. if (AwtTFMain != null)
  106. AwtTFMain.parent.window.javascript.AwtHide();
  107. else {
  108. //alert("'AwtBrowser::DocumentComplete'(Init 함수)가 호출되지 않았습니다.");
  109. }
  110. }
  111. if (event.keyCode == 32 || event.keyCode == 13) {
  112. event.keyCode = 0;
  113. setResult();
  114. }
  115. }
  116. function setResult() {
  117. if (document.all.cnt.value == "0")
  118. return;
  119. var selvalue = "";
  120. var selctl = null;
  121. var ctls = document.getElementsByName("nm_1rdo");
  122. for (var i = 0; i < ctls.length; i++) {
  123. if (ctls[i].checked) {
  124. selctl = document.getElementById('id_2_' + i);
  125. break;
  126. }
  127. }
  128. if (selctl == null)
  129. return;
  130. selvalue = selctl.data;
  131. if (AwtTFMain != null)
  132. AwtTFMain.parent.window.javascript.AwtHide();
  133. if (AwtTFMain != null) {
  134. AwtTFMain.parent.window.javascript.AwtSetResult(selvalue, AwtMode);
  135. } else {
  136. //alert("'AwtBrowser::DocumentComplete'(Init 함수)가 호출되지 않았습니다.");
  137. }
  138. }
  139. function hideThis() {
  140. if (AwtTFMain != null)
  141. AwtTFMain.parent.window.javascript.AwtHide();
  142. else {
  143. //alert("'AwtBrowser::DocumentComplete'(Init 함수)가 호출되지 않았습니다.");
  144. }
  145. }
  146. function search() {
  147. if (frmSearch.sword.value.length == 0) {
  148. alert('검색할 단어를 입력하세요');
  149. frmSearch.sword.focus();
  150. return false;
  151. }
  152. AwtSearchLike('./awtAjaxOra.jsp', frmSearch.sword.value);
  153. return false;
  154. }
  155. function doKey() {
  156. if (event.keyCode == 27) {
  157. hideThis();
  158. }
  159. if (event.keyCode == 40) {
  160. if (document.all.cnt.value != "0")
  161. document.getElementById("id_1rdo_0").focus();
  162. }
  163. }
  164. </script>
  165. </head>
  166. <body bgcolor="#d8f8f8" style="overflow-y:hidden; overflow-x:hidden;">
  167. <table width="240px" height="220px" border="0px" style="padding:0px">
  168. <form name="frmSearch" method="post" onsubmit="return search()">
  169. <tr>
  170. <td width="70px"><font size="2">검색어 :</font></td>
  171. <td width="150px"><input type="text" name="sword" style="width:150px;height:21px" onKeyUp="doKey()"/></td>
  172. <td width="17px" align="right"><input type="image" src="../images/b_brdSch.gif"/><input type="hidden" name="cnt" value="0"/></td>
  173. </tr>
  174. </form>
  175. <tr>
  176. <td colspan="3" width="240px">
  177. <div style="width:240px; height:190px; overflow-y:auto; overflow-x:auto; padding=0;">
  178. <table id='AwtListTable' cellspacing='0' style="width:228px; height:190px;"></table>
  179. </div>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td colspan="3" width="240px">
  184. <table style="width:240px;"><tr><td align="center">
  185. <img src="../images/btnSelectWord.gif" onClick="setWordMouse()"><img src="../images/btnCancelWord.gif" onClick="hideThis()">
  186. </td></tr></table>
  187. </td>
  188. </tr>
  189. </table>
  190. </body>
  191. </html>