그누포털 검색창이 제대로 않되네요 좀 봐주시겠어요-_-

그누포털 검색창이 제대로 않되네요 좀 봐주시겠어요-_-

QA

그누포털 검색창이 제대로 않되네요 좀 봐주시겠어요-_-

본문

홈페이지 : http://saeru.kr
아래는 포털검색창을 그누보드내부전체검색창과 합친 건데 완벽하게 되지않아서요 원인을 모르겠네요
아래와 같은 '에러'들이 나네요 어떻하지요?
<option>네이버</option> 정상
<option>야후</option>  비정상 한글이 넘어가지 않음
<option>엠파스</option> 정상
<option>네이트</option> 비정상 "" 에대한 검색결과 없습니다 출력
<option>다음</option> 정상
<option selected>새루교회</option> -홈페이지내 검색 - 비정상 -한글깨짐
<option >구글</option> -비정상 ; 구글창이 뜨다가 홈페이지 메인으로 돌아옴
<option title="예">성경</option> 정상
</select>

2. 검색을 하면 새창으로 띄우고 싶은데 html태그에서 target은 적용이 되지 않고요... 지인분이 'window.open("","",finalSearchString); ' 를 'location.href = finalSearchString;'로 대신하라고 해서 했더니 새창이 떴는데 about:blank 이라고 빈창만 뜨네요
디버깅하라는 할 줄을 몰라서요 ... 어떻하나요 ?

--------------------------


<script language="JavaScript">

<!--
function startSearch(){
searchString = document.searchForm.searchText.value;

if(searchString != ""){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = "";

if(searchEngine == 1){
finalSearchString = "http://search.naver.com/search.naver?where=nexearch&query=" + searchString;
}
if(searchEngine == 2){
finalSearchString = "http://kr.search.yahoo.com/search?fr=kr-front&KEY=&p=" + searchString;
}

if(searchEngine == 3){
finalSearchString = "http://search.empas.com/search/all.html?s=&f=&bd=&bw=&z=A&q=" + searchString +"&qn=&m=B&x=0&y=0";
}

if(searchEngine == 4){
finalSearchString = "http://search.nate.com/search/search.asp?Query=" + searchString + "&x=35&y=8";
}

if(searchEngine == 5){
finalSearchString = "http://search.daum.net/cgi-bin/nsp/search.cgi?w=tot&nil_profile=g&nil_Search=tot&q=" + searchString + "&y=10";
}
http://search.daum.net/search?w=tot&nil_profile=g&nil_Search=tot&q=성경&y=10
if(searchEngine == 6){
finalSearchString = "http://saeru.kr/bbs/search.php" + "?sfl=wr_subject||wr_content"+"&sop=and"+"&stx=" + searchString;
}
if(searchEngine == 7){
finalSearchString = "http://www.google.co.kr/search#newwindow=1&q=" + searchString+"&ei";
}

location.href = finalSearchString;
}
}

// -->

</script>


 <fieldset id="hd_sch">
<legend>사이트 내 전체검색</legend>
<form name="searchForm" target="_blank">
<table cellpadding=1 cellspacing=0 border=0>
<tr>
 <td>
        <input type="text" name="searchText" id="sch_stx" maxlength="20">
  <td>
         <select name="whichEngine" style="padding-left:5px;width:100%;height:24px;border:0;background:#fff;line-height:1.9em !important;line-height:1.6em">
    <option>네이버</option>
                <option>야후</option>
    <option>엠파스</option>
    <option>네이트</option>
    <option>다음</option>
                <option selected>새루교회</option>
                <option >구글</option>
   </select>

  </td>
 <td>
        <input type="hidden"  id="sch_submit" value="<? echo iconv("uft-8","euc-kr","검색");?>">
   
    <input type="button"  id="sch_submit" value="검색" onClick="startSearch()">
    </td>
</tr>

</table>
</form>

        </fieldset>


​ 

이 질문에 댓글 쓰기 :

답변 1

<form id="fsch">

    <select id="schOpt">

        <option data-url="http://search.naver.com/search.naver?where=nexearch&query=">네이버</option>

        <option data-url="http://kr.search.yahoo.com/search?fr=kr-front&KEY=&p=">야후</option>

    </select>

    <input id="schTxt" type="text" name="q" >

    <input type="submit" >

</form>

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

<script>

 

    var f = $("#schFrom"); // 폼아이디 입력

    var q = $("#schTxt");  // 검색 input 아이디입력

 

 

   $(document).on("submit",f,function(e){

       e.preventDefault();

        var myWindow = window.open("sch", "", "width=500, height=500");

       var o = $("#schOpt option:selected");  // 검색옵션 selectbox 아이디입력

        console.log(o.attr('data-url'))

        myWindow.location.href=o.attr('data-url')+q.val()

   })

</script> 

 

제가 질문글을 제대로 이해하고 짠건지 잘모르겟네요. 간단한데 답글이 없어서 혹시나해서요.

감사합니다. 잘 적용이 되는데 jqury  광고와 충돌하여 광고가 없어지는 현상이 일어나더라구요... 그래서 잠시 보류했어요 아무튼 좋은 방법 알려주셔서 감사해요 ^^

'location.href = finalSearchString;' 에  window.open("","",finalSearchString); 으로 대체 했닥 빈 화면만 나와서 다시 원래대로 했습니다. 지인이 디버깅하라는데 할 줄 몰라 일단 접어두었었습니다.
세크팀께서 가르쳐 주신 식은 따로 했을 때 잘 작동합니다. 예 http://saeru.kr/formNew.php
그런데 지금 홈페이지에 적용하면 충돌하는 소스가 있어 두개의 광고란이 사라져 버립니다. jqury를 삭제하면 광고란이 다시 살아나고 없애면 광고란이 사라져 버려서 어찌할 바 모르고 있네요 ^^
console.log() 에 해당하는 전체줄을 삭제하더라도 별변화가 없네요 ...

광고에 쓰는 자바스크립트에서 $가 겹치나보네요.

jQuery(document).on("submit",f,function(e){
      e.preventDefault();
        var myWindow = window.open("sch", "", "width=500, height=500");
      var o = jQuery("#schOpt option:selected");  // 검색옵션 selectbox 아이디입력
        myWindow.location.href=o.attr('data-url')+q.val()
  })

이렇게 해보시겠어요;

말씀하신데로 해도 변화없네요 그래서 head태그 사이이 스크립트들이 모여있는곳에 하니 광고란이 없어지는 현상은 나타지 않아요
다만 접속이 되었다 않되었다해요 ... -_- 그럴때는 어떤 이유인가요?

네.. 다행이도요  그런데 메인 로그인에 영향을 미쳐 로그인을 누르니 새창이 뜨는 에러가 발생하네요 -_- 그래도 정말 고맙습니다. 좋은 방법을 알았어요 이 방법을 적용하려면 그누보드를 더 자세히 살펴봐야 될 것 같아요...
 괜찮다면 위에 제가 올린 식에서 'window.open'을 사용해서 새창을 열수 있는 방법을 알려주실수 있나요... 지인은 location.href = finalSearchString; 자리에  window.open("","",finalSearchString); 를 대신하여 삽입하라 하여 했더니 about:blank만 뜨고 페이지를 보여주지 못하더라고 음... 디버깅하라는데.. 못하고 있네요
그리고 검색하는 홈페이지가 euc_kr인데 그래서      <option value="<? echo iconv("uft-8","euc-kr","검색");?>">성경</option> 게 사용해도 될런지요.... 그 홈페이지 접속할 때마다 문자가 깨지거든요...
해당홈페이지 주소는 http://www.holybible.or.kr/ 입니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 55
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT