[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

@ -104,7 +104,8 @@ document.onkeydown = noRefresh ;
<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();
@ -113,8 +114,8 @@ document.onkeydown = noRefresh ;
// 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
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++;
}
@ -124,6 +125,7 @@ document.onkeydown = noRefresh ;
f.stx.focus();
return false;
}
f.stx.value = stx;
return true;
}