views:

24

answers:

1

So, I want to search for a text (say "wikipedia") and have all the "wikipedia" in the page turn into a link that redirects to wikipedia.

Thanks!

A: 

I wouldnt do this by using the solution linked by VoteyDisciple, walking all elements could take a long time, and replacing innerHTML could lead you to unwanted results, while this will not only access TextNodes.

I would prefer textRanges to do this.

in MSIE: find the string with findText() and replace it using pasteHTML

in others(except opera): find the string with window.find() and surround it using surroundContents()

For opera I actually dont know a method how to find text, maybe there is an opera-specific method available.

Dr.Molle