请教一下各位高手,我想写一个关于浏览器的程序,但不知道怎么下手,请高手指点一下,具体功能如下:1.打开一个网页,风页上面有一页或多页的一个数据表格,可否把这个表格在显示这个网页的同时,把这个表格里的数据提取出来存放到数据库中2.自动填表,同样也是一个表格,表格中有很多行,每一行都有二三个空值需要填写,可否在数据库中的某一个表的数据自动填写到这个网页表格中,然后自动提交给服务器,在返回服务器的消息,提交成功下一步,如果提交不成功重新提交一次请高手指点一下,不胜感谢.
调试欢乐多
用TWebBrowser,代码是erhan发过的,如果有用,一起向erhan致敬吧。
下面是从表格取数据的部分。
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHtml;type
TForm1 = class(TForm)
wb1: TWebBrowser;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
wb1.Navigate('http://localhost:12880/mtm/abc.htm');
end;procedure TForm1.Button1Click(Sender: TObject);
var
doc: IHTMLDocument2;
mTable: IHTMLTable;
mRow: IHTMLTableRow;
mCell: IHTMLElement;
mElement: IHTMLElementCollection;
i,j: integer;
begin
doc := wb1.Document as IHTMLDocument2; mTable := doc.all.item('xxxx',0) as IHTMLTable;
for i:=0 to mTable.rows.length-1 do
begin
mRow := mTable.rows.item(i,0) as IHTMLTableRow; for j:=0 to mRow.cells.length-1 do
begin
mCell := mRow.cells.item(j,0) as IHTMLElement;
showmessage(mCell.innerHTML);
end;
end;
end;end.