0
내 검색 양식은 텍스트 상자에 "팁"을 사용합니다.이 때 텍스트 상자를 지우고 onfocus하면 "팁"이 표시됩니다.텍스트 상자에 "팁"값이 있는지 확인하십시오. 자바 스크립트로
<script type="text/javascript">
function checkform(form)
{
if (search.s.value == "Pesquisar...") || (search.s.value == "") {
var term = prompt("Enter a value:");
if (term) { search.s.value = term; }
else { return false; }
}
}
</script>
<form id="search" method="get" action="[@siteurl]/search.php" onsubmit="return checkform(this);" >
<fieldset>
<input type="text" name="s" value="Pesquisar..." onfocus="if(this.value=='Pesquisar...') { this.value=''; }" onblur="if(this.value=='') { this.value='Pesquisar...'; }" />
<input type="submit" id="searchsubmit" value="Go!" />
</fieldset>
</form>
이것은 작동하지 않습니다. 프롬프트 대신 팁 텍스트를 검색합니다. 뭐가 잘못 되었나요?
일했다. 감사. –
@LucasMatos :-) – Sibu