procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
begin
for i := 0 to (WebBrowser1.OleObject.Document.frames.Length - 1) do
if WebBrowser1.OleObject.Document.frames.item(i).document.queryCommandEnabled('Copy') then
ShowMessage('copy command is enabled for frame no.' + IntToStr(i));
end;
163邮箱登陆
procedure TForm1.Button2Click(Sender: TObject);
var
o : Olevariant;
begin
webbrowser1.Navigate('http://www.163.com');
o := WebBrowser1.OleObject.document.all.item('username',0);
o.value := 'username';
o := WebBrowser1.oleobject.document.all.item('Password',0);
o.value := 'password';
o :=WebBrowser1.oleobject.document.all.item('login',0);
o.Click;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Form:IHTMLFormElement;
HTMLDocument2:IHTMLDocument2;
begin
HTMLDocument2 := WebBrowser1.document as IHTMLDocument2;
if HTMLDocument2.forms.length > 0 then
begin
Form := (HTMLDocument2.forms as IHTMLElementCollection).item(0,0) as IHTMLFormElement ;
(Form.item(0,0) as IHTMLInputTextElement).value := 'naughtyboy';
(Form.item(1,0) as IHTMLInputTextElement).value := 'iamnaughtyboy';
Form.Submit;
end;