Wow!
This is incredible... This alone completely satisfies the question! I've got to give this an A... Thank you so much!
Two more things though if you don't mind...
How should I edit the javascript code in your example if I wanted to forgo the tooltip altogether?
How should I edit the code if I wanted to highlight only the first instance of the term within an article?
Again, thanks for your help!
Main Topics
Browse All Topics





by: rdivilbissPosted on 2005-08-05 at 17:19:50ID: 14612571
What I would do is create a list of these words and their associated tooltips, which I would keep in a database and retrieve into a client side array when the page loads.
highlightG lossaryTer ms.asp
>
hlightGlos saryTerms( );</script >
However, lets assume you do not have a database...then you can do this all client side and you won't have to modify all your pages, except to add a couple of lines to each.
See live example: http://www.rodsdot.com/ee/
You can put all the search terms in a single file along with the JavaScript function to highlight those terms. That file can be included in each page with:
<script type="text/javascript" src="glossary.js"></script
then at the bottom of each page, just before the closing body tag </BODY> add,
<script type="text/javascript">hig
Just two lines.
If you want to, you can use server side code to retrieve the glossary terms from a database, but really, that probably will not be faster, as a JavaScript include file is just text and loads very fast, even if you had thousands of terms.
Regards,
Rod