uses mshtml;
procedure WBLocateHighlight(WB: TWebBrowser; Text: string) ; const prefix = '<span style="color:white; background-color: red;">'; suffix = '</span>'; var tr: IHTMLTxtRange; begin if Assigned(WB.Document) then begin tr := ((wb.Document AS IHTMLDocument2).body AS IHTMLBodyElement).createTextRange; while tr.findText(Text, 1, 0) do begin tr.pasteHTML(prefix + tr.htmlText + suffix) ; tr.scrollIntoView(True) ; end; end; end;
Usage: WBLocateHighlight(WebBrowser1,'delphi') ; ~~~~~~~~~~~~~~~~~~~~~~~~~

|