(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: Textarea mit Twebbrowser ausfühlen
14. Jan 2009, 11:41
Hallo,
Sollte so funktionieren:
Delphi-Quellcode:
uses
MSHTML:
procedure WB_SetTextAreaValue(Document: IDispatch; sName, sValue: string; Options: TFindOptions);
var
Doc2: IHTMLDocument2;
i: Integer;
field: IHTMLElement;
textarea: IHTMLTextAreaElement;
begin
if Supports(Document, IHtmlDocument2, Doc2) then
for i:= 0 to Doc2.all.length - 1 do
begin
field := Doc2.all.item(i, '') as IHTMLElement;
if Assigned(field) then
begin
if field.tagName = 'TEXTAREA' then
begin
textarea := field as IHTMLTextAreaElement;
if Assigned(textarea) then
begin
if ((frWholeWord in Options) and (sName = textarea.Name))
or ((Options = []) and (AnsiPos(sName, textarea.Name) <> 0)) then
textarea.Value := sValue;
end;
end;
end;
end;
end;
Delphi-Quellcode:
procedure TForm1.Button7Click(Sender: TObject);
begin
WB_SetTextAreaValue(Webbrowser1.Document, 'gb[', 'Line1'#13#10'Line2', []);
end;
Thomas
|
|
Zitat
|