How to call onkeypress event in a html page (Delphi)
How c开发者_高级运维an i call onkeypress event of a textarea control in a html page using WebBrowser?
This is a way with late binding:
procedure TBrowserPageIE.Test;
var
doc : OleVariant;
el : OleVariant;
v : OleVariant;
begin
if FBrowser.Document <> nil then begin
doc := FBrowser.Document;
el := doc.getElementById('myTextArea');
el.FireEvent('onkeypress', v);
end;
end;
Please add some code for nil/exception handling.
精彩评论