Ehsan Mahpour’s Weblog

A Safer way to high light texts on html pages.

by mahpour on Dec.11, 2006, under HTML/CSS Tips

I suggested a method to highlight a text in a html page using javascript replace command and regular expressions in my last post. the problem with that code is showing up when your search keyword matches with your html tags and styles then it destroys the html structure of the page.
I just found a new better way to highlight texts (even segmented ones) on a html page. this code even can dettect the refferer search keywords and highlight them on the current page. for instance if your page is opened using a google search it can highlight the searched keywords that you have used on the google search page using referer object.

http://www.nsftools.com/misc/SearchAndHighlight.htm

please leave your comments and suggestions…


Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...