검색창에 검색어를 랜덤으로 넣을 수 있을까요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

검색창에 검색어를 랜덤으로 넣을 수 있을까요? 정보

검색창에 검색어를 랜덤으로 넣을 수 있을까요?

본문

링크를 클릭해 보시면 새로고침을 할때마다 검색창에 검색어들이 변경이 되서 나오는데..

검색어를 한개를 넣는것은 찾아서 해결했는데, 여러개가 랜덤으로 출력되는것은 도저히 못찾겠네요..ㅠㅜ

혹시 검색어가 여러개 출력되게 할려면 어떻게 해야하는지 조언좀 구할 수 있을까요?

아래는 검색어 창 소스입니다.
--------------------------------------------------------------------------------------
<!-- 검색 시작 !-->
<table width="260" cellspacing="0" cellpadding="0">
<tr>
    <td>
        <form name="fsearchbox" method="get" onsubmit="return fsearchbox_submit(this);" style="margin:0px;">
        <!-- <input type="hidden" name="sfl" value="concat(wr_subject,wr_content)"> -->
        <input type="hidden" name="sfl" value="wr_subject||wr_content">
        <input type="hidden" name="sop" value="and">
        <table width="100%" height="33" cellspacing="0" cellpadding="0">
        <tr>
            <td valign="middle"><INPUT name="stx" type="text" maxlength=30 style="BORDER : 5px solid; width : 400px; padding:8px; bold; HEIGHT : 37px; COLOR : #465DD0" maxlength="30" value="학교를 검색해 보세요" onFocus="this.value=''"></td>
            <td width="10"></td>
<td>&nbsp;&nbsp;&nbsp;<input type="image" src="<?=$g4['path']?>/img/search_button.gif" border="0"></td>
        </tr>
        </table>
        </form>
    </td>
</tr>
</table>

<script language="JavaScript">
function fsearchbox_submit(f)
{
    if (f.stx.value.length < 2) {
        alert("검색어는 두글자 이상 입력하십시오.");
        f.stx.select();
        f.stx.focus();
        return false;
    }

    // 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
    var cnt = 0;
    for (var i=0; i<f.stx.value.length; i++) {
        if (f.stx.value.charAt(i) == ' ')
            cnt++;
    }

    if (cnt > 1) {
        alert("빠른 검색을 위하여 검색어에 공백은 한개만 입력할 수 있습니다.");
        f.stx.select();
        f.stx.focus();
        return false;
    }

    f.action = "<?=$g4['bbs_path']?>/search.php";
    return true;
}
</script>
<!-- 검색 끝 !-->
--------------------------------------------------------------------------

댓글 전체

<?
$a = array();
$a[] = "신상품";
$a[] = "중고상품";
$a[] = "중고상품"; 
shuffle($a);
?>
이건 상단에 넣고요


value="학교를 검색해 보세요"  이걸 아래처럼변경

value="<?=$a[0]?>"
전체 57 |RSS
그누4 질문답변 내용 검색

회원로그인

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