[fix] 사이트 내 전체검색 > 검색어 양 끝의 공백 제거

This commit is contained in:
kjh
2022-10-05 11:50:08 +09:00
parent a21d02f4c5
commit 0f3e6125b5
10 changed files with 50 additions and 30 deletions

View File

@ -95,7 +95,8 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
<script>
function fsearchbox_submit(f)
{
if (f.stx.value.length < 2) {
var stx = f.stx.value.trim();
if (stx.length < 2) {
alert("검색어는 두글자 이상 입력하십시오.");
f.stx.select();
f.stx.focus();
@ -104,8 +105,8 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
// 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
var cnt = 0;
for (var i=0; i<f.stx.value.length; i++) {
if (f.stx.value.charAt(i) == ' ')
for (var i = 0; i < stx.length; i++) {
if (stx.charAt(i) == ' ')
cnt++;
}
@ -115,6 +116,7 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
f.stx.focus();
return false;
}
f.stx.value = stx;
return true;
}