...Building a Basic Web Page and More...... |
A JavaScript Searchable Database |
My original introduction to Web site design was a request to produce
a catalogue. Hours of research and trawling the web produced many examples but none as good as this one - a
script which will allow you to set up a searchable database of your own site. If you haven't used NipperSoft's
search engine yet, use this link. Try it and see if you like it as
much as I do. It accepts multiple words, is non-case sensitive and acts much like your usual web search engine. (Many thanks to its author, Satadip Dutta and to Joe Burns, HtmlGoodies) |
Before you dive in, grab and use the script, the author asks you to
respect these few requirements. This is only understandable and they really are extremely reasonable!
Next point: You must get the entire script and it is quite big. If you download it and it doesn't run - it is either your browser, the download or the use of margins when you edited it. Another next point: JavaScript must be in the same shape when it is posted to your site as when you acquired it - if it isn't then it won't work. ALWAYS edit the scripts in an editor without margins, like NotePad. Tip: Fix one error at a time - earliest error first, it may be the one causing all the rest! OK - Click here for the Database Script - jsdatabase.txt |
Now that you have the script, you will need to change one or two
things and add your pages to the script. I'll start at the top and work down the script. After the copyright
description, find a short line that reads:
title [0] = 6The number, in this case 6, refers to the number of pages that have been added to the database. This number must be changed to the number of pages that you add. You can do this when you have finished adding your pages. But don't forget to do it. If you don't only the first six will be searched! Now, just below this line is a comment line <!--Begin List of Searchable Items --> .
This is where you begin to replace and add your pages. Below the comment line you will see groupings:
title [1]="yahoo search engine"You need to add and/or alter each one of these groupings for every page you want the script to search.
When you have finished adding your pages, remember to go back and change the title [0] = 6 line.
Replace the number 6 with the number of pages you have added. If you don't, only the first six will be searched.Last but not least, look for the comment line - //prepare for document write. - towards the bottom of the script.Below this look for output.document.write('<title>Goodies Search Results </title>'); change the name to
that of your Search Result title.This title will appear in the search results Window title bar (the blue bar at the top). Finally, just below this line is a similar one. Change this to reflect the name of your Search Results. This will appear as the heading in the Search Results Table. That's it folks. Remember the requirements and edit all this in NotePad. Add it to your page ( copy and paste in NotePad ) between </HEAD> and <BODY>. Give thanks to Satadip Dutta and Joe Burns. Best of luck - ain't it brill! |
Java Script | Top of Page |