Make your own free website on Tripod.com
    actual Notes      JavaScript SiteSearch
The Fast SiteSearch JavaScript Engine is now provided in the version 5.

Please use the download page to receive the sources or a zip file with a complete example.

29-December-2001



The Fast SiteSearch JavaScript Engine in the version 4.1 and above
supports no more Netscape version 3 (Netscape Gold) browsers.

22-December-2001



In the update of the return or enter key pressing below (see note from 20. December 2001),
there could be inserted an additional JavaScript code to ensure that the
return or enter key pressing is sensible only at focusing of the search field entry.
It's importent if there are more as one FORM elements in your search page
(if you have only one FORM in your search page you could ignore this additional JavaScript code).

The global variable search_field_focus and the function set_return_enter_key(status)
are to insert and the keyDown(e) is to replace, like:

  ... more JavaScript code ...
  var search_field_focus = true;
  function set_return_enter_key(status) {
    search_field_focus = status;
  }
  function keyDown(e) {
    var ok=false;
    if (navigator.appName=="Microsoft Internet Explorer") if (window.event.keyCode == 13) ok=true;
    if (navigator.appName=="Netscape") if (e.which == 13) ok=true;
    if (ok && search_field_focus) document.searchForm.find.click();
  }
  document.onkeydown = keyDown
  ... more
             
and the search FORM element

<INPUT ... name='search_name'>

within the HTML search page is to complete with events onfocus and onblur:

  ... more HTML ...
  <SCRIPT LANGUAGE="JavaScript">
  <!-- 
  var browserName = navigator.appName; 
  var browserVer = parseInt(navigator.appVersion);
  if ( (browserName == "Netscape" && browserVer >= 4) || 
       (browserName == "Microsoft Internet Explorer" && browserVer >= 4) ) {

    document.writeln("<FORM NAME='searchForm' onsubmit='return checkField();' target='main'>");
    document.writeln(" <FONT FACE='Arial' SIZE=-1>Please enter term(s) below and press <b>find</b> button:</FONT><BR>");
    document.writeln(" <FONT FACE='Arial' SIZE=-1>Bitte geben Sie einen Begriff ein und klicken <b>find</b>:</FONT><BR>");
    document.writeln(" <INPUT TYPE='text' SIZE=28 NAME='search_name' onfocus='set_return_enter_key(true)' onblur='set_return_enter_key(false)'><BR>");
    document.writeln(" <INPUT TYPE='button' name='find' VALUE='Find' onClick='checkField()'>");
    document.writeln(" <INPUT TYPE='reset'  VALUE='Clear' onClick='this.form.search_name.focus()'><br>");
    document.writeln(" <FONT FACE='Arial' SIZE=-1>Fast SiteSearch JavaScript Engine!</FONT><br>");
    document.writeln("</FORM>");
    document.writeln(" ");
  } else { 
      document.writeln(" Sorry! Your Web browser does not support this version of SiteSearch JavaScript.<p>");
      document.writeln(" ");
    }
  //-->
 </SCRIPT>
 ... more HTML ...
             
22-December-2001


There was an error on using this SiteSearch JavaScript in newer browsers like IE 5.5 or NS 6.
The return or enter keys could not be pressed after typed in the search key.
It's now fixed by the following additional JavaScript code and BODY tag
for inserting at the bottom of the previous used script (versions 3 and 4):

   ....more JavaScript code... 
   function keyDown(e) {
    if (navigator.appName=="Microsoft Internet Explorer")
     if (window.event.keyCode == 13) document.searchForm.find.click();
    if (navigator.appName=="Netscape")
     if (e.which == 13) document.searchForm.find.click();
   }
   document.onkeydown = keyDown
  // -->
  </SCRIPT>
  <BODY bgcolor="#ffffff"
      onKeyDown="keyDown()"
      onLoad="if (document.searchForm) document.searchForm.search_name.focus()">
  ....more HTML ... 
            
and the FORM on the search page is now designed for Netscape & Microsoft
browser versions >= 4 (version 3 is no more supported):

  <SCRIPT LANGUAGE="JavaScript">
  <!-- 
  var browserName = navigator.appName; 
  var browserVer = parseInt(navigator.appVersion);
  if ( (browserName == "Netscape" && browserVer >= 4) || 
       (browserName == "Microsoft Internet Explorer" && browserVer >= 4) ) {
    document.writeln("<FORM NAME='searchForm' onsubmit='return checkField();'>");
    document.writeln(" <FONT FACE='Arial' SIZE=-1>Please enter term(s) below and press <b>find</b> button:</FONT><BR>");
    document.writeln(" <FONT FACE='Arial' SIZE=-1>Bitte geben Sie einen Begriff ein und klicken <b>find</b>:</FONT><BR>");
    document.writeln(" <INPUT TYPE='text' SIZE=28 NAME='search_name'><BR>");
    document.writeln(" <INPUT TYPE='button' name='find' VALUE='Find' onClick='checkField()'>");
    document.writeln(" <INPUT TYPE='reset'  VALUE='Clear' onClick='this.form.search_name.focus()'><br>");
    document.writeln(" <FONT FACE='Arial' SIZE=-1>Fast SiteSearch JavaScript Engine!</FONT><br>");
    document.writeln("</FORM>");
    document.writeln(" ");
  } else { 
      document.writeln(" Sorry! Your Web browser does not support this version of SiteSearch JavaScript.<p>");
      document.writeln(" ");
    }
  //-->
 </SCRIPT>
 <NOSCRIPT>
 Sorry!<br> Your Web browser does not support this JavaScript<br>
 or<br> JavaScript is disabled on your used Web browser (see settings on <i>Preferences</i>).<br><br>
 Pardon!<br> Ihr Web-Browser unterstützt dieses JavaScript nicht<br>
 oder<br> Ihr Web-Browser hat JavaScript nicht aktiviert (siehe <i>Einstellungen</i>).<br><br>
 </NOSCRIPT>
 <FONT FACE='Arial' SIZE=-2>This <a href='http://schick.tripod.com/'><b>SiteSearch</b></a> JavaScript Engine
 runs in Netscape browser (version >=4) and<BR>
 Microsoft Internet Explorer (version >=4) only, if <b>JavaScript</b> is enabled.</FONT>
            
The source of the SiteSearch JavaScript has been updated and has now the version number 4.1.

20-December-2001



Now, there is a new SiteSearch JavaScript (version 4) with simplified indexing.
On indexes, there is only to quote the referenced
Web page and all following keywords separated by
commas (this saves some space on the JavaScript source).
A complete working example is included in that zip file for
downloading:  

...and there with included archived zipped index file: .

Extract a zip file to a subdirectory and load the included HTML
file into a Web browser.
15-May-2000



There is a complete working example of that SiteSearch JavaScript with TARGETing
to a blank browser window. Some users asked me to target the click on a found
result into a new or other browser window. This example includes a search
index of my photo gallery hosted at Germany.net. Enjoy it and make a break
with nice landscape photos from around the world. There is also a zip file
with that photo gallery site search for downloading:
25-MAR-2000


There can be used a compressed SiteSearch JavaScript on Netscape version 4 browsers only.
But Microsoft's IE browser does not uncompress the zip archive file; for that, provide also
the file my_SiteSearch.js to run the SiteSearch Script also in Microsoft's IE Web browsers

To use a zipped (compressed) file, i.e. my_SiteSearch.js zipped in
my_SiteSearch.zip as archive, include these files, like

  <HTML>
  <HEAD>
  <TITLE>My Site Search Page</TITLE>>
    <!-- should be a comment line -->
    <SCRIPT LANGUAGE="JavaScript"
                  SRC="my_SiteSearch.js"
                  ARCHIVE="my_SiteSearch.zip">
    </SCRIPT>
    <!-- needs one comment line -->
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    ... more
    //-->
    </SCRIPT>
    <!-- should be a comment line -->
  </HEAD>
  <BODY>
    ... more
    </BODY></HTML>

and transfer your Site Search HTML page, the zipped my_SiteSearch.zip
and my_SiteSearch.js files to your Web site.

This compressed file is smaller than the SiteSearch JavaScript uncompressed
text. The net traffic is short. But otherwise, if the user starts its browser
and loads your Site Search page at first before Java runs, the SUN time to
start Java on the browser for unpacking the small zipped file consums a little
bit time.
24-MAR-2000, 26-MAY-2001


If a separate external index .js file is used within that SiteSearch JavaScript,
(i.e. to load the index file my_keywords.js) there is to include a comment
line: <!-- comment line --> between the JavaScripts,
like:

  <HEAD>
    <!-- should be a comment line -->
    <SCRIPT LANGUAGE="JavaScript" SRC="my_keywords.js"></SCRIPT>
   
    <!-- needs one comment line -->

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    ... more
    //-->
    </SCRIPT>
    <!-- should be a comment line -->
  </HEAD>

Some ISPs include banners or JavaScripts into your Web page at the top or
the end of the <HEAD> part too. In general, it's also recommended to
start and end your SiteSearch JavaScript or other JavaScripts with comment lines.
14-FEB-2000

There was a bug with IE 5.0. The generated FORM for the search page was incorrect
for that Microsoft Internet Explorer new version 5.0. That browser crashes
after submit of the FORM. It's now fixed in version 3.0 of the SiteSearch JavaScript
16-AUG-1999.



There was noted, that sometimes ISP sites (which appends a banner
to a page) or some Proxy-Server doesn't pass that SiteSearch JavaScript
to the user's browser correctly (it's was garbled)   -this is now fixed in versions 1.23 and above -


There is no permission to use that SiteSearch JavaScript on sites with adult material.


If the home page with a link to your search page uses frames, check the spelling
of the frame name for the search result output page within the SiteSearch
JavaScript and on the frameset page of your home page. These frame names
in these HTML documents are case sensitive.


There was reported, that the refresh time of the search page from within
a navigation frame (like the left one here) is longer. The newer browser
versions (Netscape 4.* and IE 4.*5.*) load after every search the full search
page with search field entry once more again over the net. If the
search page (with search field entry) is placed on the main frame (like this
one here), there is no loading over the net. The refresh time is shorter
(loading from the browser's cache).
There is a frameset page about that handling from within different frames.


It can be used an external index file together with that JavaScript. That's
usefull to maintain the index on that separate index file only. On the index
section within that JavaScript there
is to insert the external index file, like "my_keywords.js" with these
statements:

    // Initialization Section for the Index    -->
    </SCRIPT>
    <!-- needs one comment line -->
    <SCRIPT LANGUAGE="JavaScript" src="my_keywords.js"></SCRIPT>
    <!-- needs one comment line -->
    <SCRIPT LANGUAGE="JavaScript">
    <!--

and it is to remove the index in that JavaScript until
there. With that method there are to
send two files to the Web server (the SiteSearch page and the external index
file).  The maintenance of that smaller index file could be a little bit simpler.


The number of indexed pages is not limited, but for practice use there should
be included less than 200 indexed pages or, at least the size of that HTML
document with the index should be not greater than 40 KByte. Your visitors
of your SiteSearch page have to load that document over the Net.


The search by keywords is case insensitive and all keyword matches are
listed and count on a result output page (keyword matches could be reduced
to only one occurrence, but this is not implemented and maybe, not useful).
Wildcard character asterik * is allowed at the beginning or end of the search
term input.


Note, that in Netscape version 3 browsers the start of a search needs clicking
of the Find button (point with mouse to there and click the left mouse button).
Using of the enter or return key on keyboard looks to the user's current
directory on its local disk instead. Microsoft's IE version 4 (but not version 5)
& Netscape version 4 support the enter or return key on the keyboard.