링크를 클릭해 보시면 새로고침을 할때마다 검색창에 검색어들이 변경이 되서 나오는데..
검색어를 한개를 넣는것은 찾아서 해결했는데, 여러개가 랜덤으로 출력되는것은 도저히 못찾겠네요..ㅠㅜ
혹시 검색어가 여러개 출력되게 할려면 어떻게 해야하는지 조언좀 구할 수 있을까요?
아래는 검색어 창 소스입니다.
--------------------------------------------------------------------------------------
<!-- 검색 시작 !-->
<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> <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>
<!-- 검색 끝 !-->
--------------------------------------------------------------------------
검색어를 한개를 넣는것은 찾아서 해결했는데, 여러개가 랜덤으로 출력되는것은 도저히 못찾겠네요..ㅠㅜ
혹시 검색어가 여러개 출력되게 할려면 어떻게 해야하는지 조언좀 구할 수 있을까요?
아래는 검색어 창 소스입니다.
--------------------------------------------------------------------------------------
<!-- 검색 시작 !-->
<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> <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>
<!-- 검색 끝 !-->
--------------------------------------------------------------------------
댓글을 작성하시려면 로그인이 필요합니다.
댓글 2개
$a = array();
$a[] = "신상품";
$a[] = "중고상품";
$a[] = "중고상품";
shuffle($a);
?>
이건 상단에 넣고요
value="학교를 검색해 보세요" 이걸 아래처럼변경
value="<?=$a[0]?>"