폼 에서 질문요.

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

댓글 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 질문답변

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

+
제목 글쓴이 날짜 조회
18년 전 조회 1,517
18년 전 조회 1,288
18년 전 조회 2,698
18년 전 조회 1,600
18년 전 조회 2,680
18년 전 조회 1,584
18년 전 조회 1,518
18년 전 조회 1,516
18년 전 조회 1,407
18년 전 조회 1,216
18년 전 조회 1,601
18년 전 조회 1,536
18년 전 조회 1,538
18년 전 조회 961
18년 전 조회 1,658
18년 전 조회 1,609
18년 전 조회 1,513
18년 전 조회 1,616
18년 전 조회 1,546
18년 전 조회 1,572
🐛 버그신고