I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text:
function hiliter(word, element) { var rgxp = new RegExp(word, 'g'); var repl = '' + word + ''; element.innerHTML = element.innerHTML.replace(rgxp, repl); } hiliter('dolor');