掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
WebBrowser画面の選択部分のソースの取得は? (ID:19483)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
IHTMLDocument2 には getElementsByTagName がないみたいです。(参考:MSHTML_TLB.pas) IHTMLDocument3 には getElementsByTagName があるので、こっちに変えてみてください。 (なんで、IHTMLDocumentは1〜5 まであるのでしょうか? また、それらはどのように使い分けするのでしょうか? たれか教えてください) とにかく、下のコードで getElementsByTagName が使えました。 'A' の代わりに 'HTML' を入れるとhtmlタグ下のソースが得られます。 ただし、Webサーバー上にあるhtmlファイルに書かれたそのままの形ではなく 整形された形で得ることになるようです。 /////////////// var I: Integer; xDoc3: IHTMLDocument3; xAll: IHTMLElementCollection; xElement: IHTMLElement; begin xDoc3 := ie.ieObject.Document as IHTMLDocument3; xAll := xDoc3.getElementsByTagName('A') as IHTMLElementCollection; Memo1.Lines.Add( IntToStr( xAll.length ) ); for I := 0 to (xAll.length -1) do begin xElement := xAll.item(I, varEmpty) as IHTMLElement; //Memo1.Lines.Add( xElement.tagName ); Memo1.Lines.Add( IntToStr(I) + ':' + xElement.outerHTML ); end; /////////////// ---------- 役立つリンク: COM Event Sink Generator http://www.techvanguards.com/ もしくは、 TieAutomationコンポーネント http://www33.ocn.ne.jp/~takoyakusi/delphi/InternetProg.html で、イベントシンク ページの中でのOnClick、OnMouseOver、OnMouseOut とかのイベントの実装の仕方(何語?) http://www.effie.co.il/default.asp?sec=printview&topic=delphiasp&lang=he エレメント階層を調べる http://www.microsoft.com/japan/msdn/library/default.asp?url=/japan/msdn/library/ja/jpisdk/dhtml/doc_object/doc_object.asp
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.