노

폼 에서 질문요.

검색 폼 만드는데요.
 
폼 안에 기본 텍스트를 넣을 수 있잖아요.
 
예를 들어 "검색어를 입력 하세요" 라는 ... 등의
 
근데 이걸 폼안에 커서를 찍으면 자동으로 없어지게 하는 방법을 알고 싶습니다.
 
온클릭 하면 자동으로 기본문구가 없어지는 ...
 
로그임 폼중에 이런 폼들이 있던데 이것저것 비슷하게 적용해도 안되어서요.
 
부탁드리겠습니다 ^^
|

댓글 2개

제가 사용하는 방법 입니다. http://demo.edu114.pe.kr

<!--검색 시작-->
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" height="30" border="0" cellspacing="0" cellpadding="0">
<form name="fsearchbox" method="get" action="javascript:fsearchbox_submit(document.fsearchbox);">
<input type="hidden" name="sfl" value="wr_subject">
<input type="hidden" name="sop" value="and">
<tr>
<td width="5"></td>
<td align="center">
<input name="stx" onblur="this.style.background='#ffffff'" style="BORDER-RIGHT: rgb(204,204,204) 1px solid; BORDER-TOP: rgb(204,204,204) 1px solid; BACKGROUND-IMAGE: url(../img/sc_bg.gif); BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 150px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; HEIGHT: 19px" onfocus="this.style.background='#ffffff'" size="20" maxlength="15"></td>
<td width="51" align="right"> <input type="image" src="../img/scin.gif" width="47" height="21" border="0"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>

<script language="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 = "../bbs/search.php";
f.submit();
}
</script>
<!-- 검색 끝 -->
고맙습니다. ^^ 큰 도움이 되었네요 ~
댓글을 작성하시려면 로그인이 필요합니다.

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

+
제목 글쓴이 날짜 조회
07-04-24 조회 2,822
07-04-24 조회 1,686
07-04-24 조회 2,766
07-04-24 조회 1,666
07-04-24 조회 1,610
07-04-24 조회 1,602
07-04-24 조회 1,495
07-04-24 조회 1,306
07-04-23 조회 1,689
07-04-23 조회 1,629
07-04-23 조회 1,628
07-04-23 조회 1,044
07-04-23 조회 1,765
07-04-23 조회 1,703
07-04-23 조회 1,608
07-04-23 조회 1,735
07-04-23 조회 1,653
07-04-23 조회 1,667
07-04-23 조회 1,077
07-04-23 조회 1,615