sent
in the following hack...
Here is a modification to SiteSearch which saves users a click. It
automatically puts the insertion point in the 'Keywords' text entry box when
the page is loaded, so users don't have to click in order to type there.
For another example of the same, see www.google.com.
To implement this, simply edit search_define.pl and alter the lines
indicated with a plus (+) sign. It has been tested successfully on the
following browsers:
- Windows NT 4 with IE5
- Netscape Communicator 4.51 on Red Hat Linux 6.0.
#############################################################
# Focus On Keywords enhancement for SiteSearch
# Modify search_define.pl as indicated by the plus (+) signs.
# By Phil Jones (p.jones@northsurreywater.co.uk).
#############################################################
sub PrintNoKeywordHTML
{
print <<__NOKEYHTML__;
<HTML>
<HEAD>
<TITLE>Keyword Search Engine</TITLE>
</HEAD>
+ <SCRIPT>
+ <!--
+ function focus_on_keywords() {
+ document.form_keywords.keywords.focus();
+ }
+ -->
+ </SCRIPT>
+ <BODY BGCOLOR="#ffffff" onload="focus_on_keywords()">
<CENTER>
<H2>Keyword Search Engine</H2>
</CENTER>
<HR WIDTH = "50%">
<P>
+ <FORM METHOD="POST" ACTION="search_engine.cgi"
+ onload="focus_on_keywords()" name="form_keywords">
+ <B>Enter your keywords</B> <INPUT TYPE="text" SIZE="30"
+ NAME="keywords" MAXLENGTH="80">
<P>
<INPUT TYPE="checkbox" NAME="exact_match"> Exact Match Search
<HR WIDTH = "50%">
<CENTER>
<INPUT TYPE="SUBMIT" VALUE="Submit keywords">
<INPUT TYPE="RESET" VALUE="Clear this form">
</CENTER>
</FORM>
</BODY>
</HTML>
__NOKEYHTML__
} # End of PrintNoKeywordHTML