zengun

weblog

20021102

highlight just like Google

I like searchhi, but it highlights keywords in only one color. So I did a very little modification to make it use different colors, and here’s the resulting code.
To effectively highlight keywords with different colors, you’ll need to create 10 classes, named ’searchword1′, ’searchword2′, […], ’searchword9′, ’searchword0′. Though if you don’t define one or more of these classes, the word will still be highlighted using the class ’searchword’. That’s the beauty of CSS.


one response

  1. ermm, i gope v1.0 will highlight the search word, or rather is that a hack to do tt?

    #1 GamerZ2002/11/02 at 8:23

Your words


Required fields:
Are marked by this sign: *
XHTML:
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
On comment spam/irrelevance:
Your comment may be moderated or considered as spam by the leprechauns running this server. If you get a 412 error or a mean message, it may be that they thought it was spam: try wording the comment differently or remind me to put up a contact form so you can warn me about the problem.
Of course, once the leprechauns are done doing their magic, I reserve the right to delete any comment for any reason.