Sciencetext Tips & Tricks
Blogging tips, browsing tricks and computing hacks

Infuriating Search Result

 

April 17th, 2007 · by David Bradley

One of the most infuriating phenomena on the net isn’t sites that crash your browser or blogs that never update, it is not even news sites that don’t seem to have a newsfeed. No, it is those little search boxes that webmasters see fit to include the word “search” smack in the middle of the form that don’t disappear when you click the search box to enter your search terms.

Why are they infuriating? Well, as soon as you realize that the form is not self-clearing, you have to then select the word that is already there (”search”) and either delete it before you add your own terms, or else select and type or paste over the top of it. If you slip with your mouse you’ll occasionally end up with the word “search” at the start or finish, or even in the middle of your keywords - e.g. signifsearchicant figures.

There is a solution, but it has to be implemented by the webmaster, there is no quick fix from the browser’s perspective (unless you know different). So, with thanks to Urban75, webmasters please embed the following in your search form as appropriate:

<FORM>
Search: <INPUT TYPE=text VALUE=”Search Text” ONFOCUS=”clearDefault(this)”>
</FORM>

(Similarly, if you insist on including the word “email” in your email subscription form then use

Email: <INPUT TYPE=text VALUE=”E-Mail Address” ONFOCUS=”clearDefault(this)”>

in there instead.

There is an additional step to make it work and it requires a wee script in the head section of your page:

<script type=”text/javascript”>
<!–
function clearDefault(el) {
if (el.defaultValue==el.value) el.value = “”
}
// –>
</script>

It’s all very easy and it saves a lot of infuriation (is that a word?). There is of course a much simpler solution that involves a serious assumption. You could simply assume that your readership knows what a search box is and will use it to search or if you have an email subscription box they will know to type their email address in order to subscribe, so you could just as easily leave out that “search” and “email” from the boxes’ startup settings in the first place. It looks slicker too.

1 response so far ↓

Leave a Comment

Comments are checked for spam before appearing, no need to post it twice.

Related Posts