Webbrowser判断网页控件是否存在?
2013-03-17 21:59
891 查看
网页代码:
delphi判断网页中是否存在某个名字的控件
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>新建网页 1</title> <script> function aa(){ alert("abc"); } </script> </head> <body> <form method="POST" action="--WEBBOT-SELF--"> <p><input type="button" value="按钮" name="B3" onclick="aa()"></p> </form> </body> </html>
delphi判断网页中是否存在某个名字的控件
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHTML_TLB; type TForm1 = class(TForm) WebBrowser1: TWebBrowser; Button1: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses Math; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin WebBrowser1.Navigate('c:\index.htm'); end; procedure TForm1.Button1Click(Sender: TObject); var b:IHTMLElement; begin b:=(WebBrowser1.Document as IHTMLDocument3).getElementById('B3'); if b=nil then exit;//这里判断网页中是不是找到了这个按钮,如果换成B4就不能执行下面的代码了 b.click; end; end.
相关文章推荐
- 判断网页控件是否存在,并修改显示属性
- Delphi_判断Webbrowser打开的网页组件是否存在?
- javascript判断网页控件是否存在的问题
- Delphi_判断Webbrowser打开的网页组件是否存在?
- c#,WebBrowser 判断网页是否加载完毕
- Webbrowser控件判断网页加载完毕的简单方法
- VB 判断 WebBrowser是否已经加载网页完毕
- 文件输入与复制(判断文件和目录是否存在)、读取网页内容
- VB下判断控件是否存在的函数
- 如何判断控件的事件是否存在
- 判断网页里面是否存在【Referer判断跳转】
- C#使用Webbrowser来判断网页是否加载完毕
- js判断网页对象是否存在
- 判断网页是否存在,可以通过get_headers()函数
- Webbrowser控件判断网页加载完毕的简单方法
- Webbrowser控件判断网页加载完毕的简单方法
- 如何用JS判断网页中某个id的网页元素是否存在
- 判断控件数组中的元素是否存在
- [转]Webbrowser控件判断网页加载完毕的简单方法
- jQuery 判断控件ID是否存在