Highlighting a text in a HTML page
by mahpour on Nov.14, 2006, under HTML/CSS Tips
Here is the javascript code which should be used somewhere on the bottom of html page (of course inside the script tags)
just replace "text_to_find" with your text (it could be a variable or a serverside string) without quotes. Also change CONTAINER_TAG_ID with the container id and enjoy.
document.getElementById("CONTAINER_TAG_ID").innerHTML= document.getElementById("CONTAINER_TAG_ID").innerHTML.replace(/(text_to_find)/gi,"< span style='background-color:yellow;'>$1< /span >");