![]() |
![]() ![]() ![]() |
IESniffer component.
|
function TIESniffer.ReplaceText(Browser: IWebBrowser2; const OldText, NewText: String;
|
WholeWords: Boolean = False; MatchCase: Boolean = False; ScanFrames: Boolean = True): Integer; // returns number of marked words
|
The ReplaceText method searches for all occurences of the OldText on the Web page and replaces it with NewText (can contain HTML tags).
|
|
Parameter | Meaning
|
Browser | is the IWebBrowser2 interface with some text which should be marked.
|
OldText | is the word or phrase which should be replaced in the HTML document by NewText.
|
NewText | the new word or phrase to which the OldText should be replaced to.
|
WholeWords | whether the Text should match whole words only.
|
MatchCase | whether the Text should match case.
|
ScanFrames | whether to scan subframes of the web page (True by default).
|
|
Function returns the number of marked text fragments, or 0 if specified Text was not found on the page.
|
procedure TForm1.IESniffer1WBDownloadComplete(Sender: TObject;
|
const URL: String; const Browser: IWebBrowser2);
|
begin
|
// change all occurances of word "Delphi" to bold "Delphi Rules!" ;-)
|
IESniffer1.ReplaceText(Browser, 'Delphi', '<b>Delphi Rules!</b>');
|
end;
|
MarkText method;
|
OnWindowLoad and OnWBDownloadComplete events.
|