검색창에 검색어 미리보여주기(로그인창 같이) > 그누4 질문답변

그누4 질문답변

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

검색창에 검색어 미리보여주기(로그인창 같이) 정보

검색창에 검색어 미리보여주기(로그인창 같이)

본문

제목과 같습니다.

그전에 보면 포털사이트에 광고성 검색어가 미리 있어서
귀찮았었는데 제가 홈피를 만들어 보니 필요 하네요.

자료를 많이 업로드 햇는데 방문자가
검색창을 이용하게 하고 싶거든요.

예를들어 경제관련 자료를 많이 올려 놓고서 검색창에
미리 "경제살리기로 검색해보세요" 이렇게 나오게 하고 싶습니다.
고수님들 부탁 드립니다.

음 이런 예가 맞는지 모르겠는데 사이트 접속하면 로긴창에 "아이디", "비밀번호"
이렇게 나오자나요 그래서 아이디넣으려고 마우스 가져가 놓으면 아이디,비밀번호
글씨 사라지면서 아이디를 넣죠 이렇게 하고 싶은거거든요.
  • 복사

댓글 전체

이미지를 넣는 게 더 깔끔해요..


이건 head에...
------------------------------------------------------------
<script language=JavaScript>
<!--
function ch () {
if ( c ) return true;
document.search.q.style.backgroundImage="";
c=true;
return true;
}
//-->
</script>


이건 body의 검색창 부분에
-----------------------------------------------------------------------
<input name=q style="font-size:14px;font-family:굴림;width:331px;height:22px;background-image:url(http://이미지 경로 주소);background-repeat:no-repeat;background-position:center;" onkeydown='return ch();' onmousedown='return ch();'>

 
설명 -------------------------------------------------------------------
background-image:url -> 배경이미지 url주소를 넣는다

background-repeat:no-repeat;background-position:center 배경이미지 옵션들...

onkeydown='return / onmousedown='return ch(); 마우스 검색창에 대고 클릭하면.. 이미지 사라짐
티파니님 답변 감사 드립니다.
그런데 전 이미지보다는 자료를 많이 업로드 햇는데 방문자가
검색창을 이용하게 하고 싶거든요.

아래에서 수정하면 될거 같은데 모르겟어요.
아래는 소스 입니다.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

include_once("$g4[path]/head.sub.php");
include_once("$g4[path]/lib/outlogin.lib.php");
include_once("$g4[path]/lib/poll.lib.php");
include_once("$g4[path]/lib/visit.lib.php");
include_once("$g4[path]/lib/connect.lib.php");
include_once("$g4[path]/lib/popular.lib.php");

//print_r2(get_defined_constants());
?>


<!-- 상단 메뉴스킨 시작 -->
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
    <td>
        <table cellspacing="0" cellpadding="0">
        <tr>
            <td><img src="<?=$head_menu_skin_path?>/img/left_top.gif" width="16" height="24"></td>
<td bgcolor="#f3f3f3" width="100"><a href="javascript:bookmark()">즐겨찾기 추가</a></td><td bgcolor="#f3f3f3" width="50%"></td>
<td bgcolor="#f3f3f3" width="400" align="right"><a href="<?=$g4['path']?>">처음으로</a> | <a href="<?=$g4['path']?>/bbs/new.php">최근게시물</a> | <a href="<?=$g4['path']?>/bbs/current_connect.php">현재접속자</a></td>
    <td><img src="<?=$head_menu_skin_path?>/img/right_top.gif" width="16" height="24"></td>
        </tr>
        </table></td>
</tr>
</table>

<div style='height:6px;'></div>

<!-- 로고 시작 -->
<table width="100%" cellspacing="0" cellpadding="0" align="center">
<tr height="5"><td></td></tr>
        <tr height='50'>
<td><a href='<?=$g4[path]?>'><img src='<?=$head_menu_skin_path?>/img/logo.gif' border='0'></a></td>
<td align='center'>
<table cellspacing='0' cellpadding='0' border='0'>
<form name='fsearchbox' method='get' action='javascript:fsearchbox_submit(document.fsearchbox);'>
<script type='text/javascript'>
function fsearchbox_submit(f)
{
if (f.stx.value == '')
{
alert('검색어를 입력하세요.');
f.stx.select();
f.stx.focus();
return;
}
/*
// 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
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;
}
*/
f.action = '<?=$g4[bbs_path]?>/search.php';
f.submit();
}
</script>
<tr>
<input type='hidden' name='sfl' value='wr_subject||wr_content'>
<input type='hidden' name='sop' value='and'>
<td>
<select id='gr_id' name='gr_id' class=select>
<option value=''>통합검색</option>
<?
if($config[cf_home_ex_search_use] == 1) $home_ex_search = $config[cf_home_ex_search];
else $home_ex_search = "''";

$excgr = "(".$home_ex_search.")";
$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_10, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0' and a.gr_id not in " . $excgr . " ORDER BY a.gr_admin";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++){
?>
<option value='<?=$row['gr_id']?>'><?=$row['gr_subject']?></option>
<?}?>
</select>
</td>
<td width='5'></td>
<td><INPUT name='stx' maxlength='100' style='width:250px;height:21;border-style:ridge;' tabIndex=1 class=ed trim value='<?=$stx?>'></td>
<td width='5'></td>
<td width='28' align='right'><INPUT type=image src='<?=$head_menu_skin_path?>/img/btn_search.gif' border='0'></td></tr>
<tr><td></td></tr></form>
        </table></td>
<td width="250"><?=banner_sero("우측배너")?>
    <td width="5"></td>
</tr>
</table>


<div style='height:6px;'></div>
<!-- 로고 끝 -->
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
    <td>
        <table height="37" cellspacing="0" cellpadding="0">
        <tr>
            <td><img src="<?=$head_menu_skin_path?>/img/m_left.gif" width="6" height="37"></td>
<td background="<?=$head_menu_skin_path?>/img/m_center.gif" width="100%" height="37"><table>
<tr>
<?
//접근가능그룹 여분필드 1 순서로 추출
//조건외 제외시키고자 하는 그룹 수동으로 추가
$excgr = "('00', '00', '00')"; // 00 , 00 , 00 그룹은 제외시킴
$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_10, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0' and a.gr_id not in " . $excgr . " ORDER BY a.gr_admin";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++){

$gSubject = ($row['gr_id'] == $gr_id)?"<span style=''>" .$row['gr_subject']."</span>":"<span style=''>" .$row['gr_subject']."</span>";//그룹제목
$gLink = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/'.'board.php?bo_table=' .$row['gr_id'];//그룹링크 - 별도링크 필요하면 gr_10 필드에 전체 url 입력
if($i > 0) echo "<td>&nbsp;<font color='ffffff'><b>|</b></font>&nbsp;</td>";  // 그룹명 출력
echo "<td><b><a href='" . $gLink . "' style='color:#ffffff;'>" . $gSubject . "</a></b></font></td>"; // 그룹명 출력
}
?>
</tr>
</table></td>
    <td><img src="<?=$head_menu_skin_path?>/img/m_right.gif" width="6" height="37"></td>
        </tr>
        </table></td>
</tr>
</table>


<!-- 상단 메뉴스킨 끝 -->
© SIRSOFT
현재 페이지 제일 처음으로