Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 팁&트릭
Delphi Programming Tip&Tricks
[254] 웹 브라우저 내의 특정 단어 하일라이팅
civilian [civilian] 5775 읽음    2008-08-12 13:20
procedure WBLocateHighlight(WB: TWebBrowser; Text: string) ;
const
   prefix = '';
   suffix = '';
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;


출처 : delphi.about.com
무능력 [sykelos]   2008-08-13 23:57 X
감사합니다~!
권창구.태원아빠 [shiftcap]   2008-09-09 14:55 X
이런 방법도 있어요.

function FindSearchString(SearchString)
{
    try{
        if (SearchString!=''){
            var TextRange = document.body.createTextRange();
           
            for (var i=0;TextRange.findText(SearchString);i++){
           
                if (TextRange.parentElement().name){
                    TextRange.execCommand('BackColor','','#FFFF00');
                    TextRange.execCommand('ForeColor','false','#FF0000');
                }
                TextRange.collapse(false);
            }
        }
    }
    catch(e){}

+ -

관련 글 리스트
254 웹 브라우저 내의 특정 단어 하일라이팅 civilian 5775 2008/08/12
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.