...

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



pts123
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

</tr>
<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">
<div>
<input size="12" name="callsign" style="font-size: 130%" maxlength="7" />
<input type="submit" value="Search" />
</div>
</form><!-- HamCall Callsign Lookup Blank END -->

jlhaslip
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">
<html>
<head>
<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;}
}
}
</script>

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

See if that works for you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum