I'm building a website which needs a search option. I think I'm going to use XSLT search for this, but that's not my question. When the search result page is visited the search result should be highlighted on that page. I've never done this before and I don't know how I should to do. Can I pass the search result with a querystring and use javascript to highlight the words or do I need to do it with XSLT? Any suggestions?
Id probably go the Querystring and javascript route myself, as it's not really that important that it needs to be built in, and it would require you to modify all your ouputs if you did.
Search with highlight
Hello,
I'm building a website which needs a search option. I think I'm going to use XSLT search for this, but that's not my question. When the search result page is visited the search result should be highlighted on that page. I've never done this before and I don't know how I should to do. Can I pass the search result with a querystring and use javascript to highlight the words or do I need to do it with XSLT? Any suggestions?
Jeroen
Id probably go the Querystring and javascript route myself, as it's not really that important that it needs to be built in, and it would require you to modify all your ouputs if you did.
Maybe take a look at this jQuery plugin:
http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
Matt
Hi Jeroen,
You could use JavaScript on the page to highlight the keywords from the search results page. Few examples...
http://www.iamcal.com/publish/articles/hacks/google_highlighter/
http://www.kryogenix.org/code/browser/searchhi/
These are based on the "document.referrer" querystring ... so make sure that they are available (as opposed to using POST to pass the query).
Cheers, Lee.
Thanks for the feedback. I'll have a look at it :).
Jeroen
is working on a reply...