View Full Version : Clearing text from a search box . . .

05-06-2009, 04:41 AM
I have a search box on my website and I finally got it working correctly with help from VIPStephan. But, there is one problem. After clicking search the box doesn't remove the entered text. I have tried a few things with no luck. Was hoping someone could give me a clue. The code for the search box is here, thanks
JD in KC http://kcHamRadio.com

<td class="tcat">Callsign Lookup:</td>
<tr bgcolor="F4EBD5">
<td align="center">
<!-- HamCall Callsign Lookup Blank START -->
<form method="POST" action="http://hamcall.net/call/ "target="_blank">
<input size="12" name="callsign" style="font-size: 130%" maxlength="7" />
<input type="submit" value="Search" />
</form><!-- HamCall Callsign Lookup Blank END -->

05-06-2009, 08:13 AM
I have this code from a previous Topic reply from VIPsteven (I think)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>js demo</title>
<script type="text/javascript">
window.onload = function() {
if (document.getElementById("inp_search")) {
var s = document.getElementById("search");
var v = s.defaultValue;
s.onfocus = function() {if(s.value==v) s.value='';}
s.onblur= function() {if(s.value=='') s.value=v;}

<form action="">
<input type="text" id="inp_search" name="search" value="Search...">

See if that works for you.