首页  编辑  

get the Selected Objects in a TWebbrowser?

Tags: /超级猛料/OS.操作系统/IE.扩展/TWebBrowser/操作/   Date Created:

get the Selected Objects in a TWebbrowser?

procedure TForm1.Button1Click(Sender: TObject);

begin

 if Webbrowser1.OleObject.Document.Selection.type = 'Control' then

 begin

   if Webbrowser1.OleObject.Document.Selection.CreateRange.CommonParentElement.tagName =

     'IMAGE' then

     ShowMessage('An Image is selected');

 end

 else

 begin

   if Webbrowser1.OleObject.Document.Selection.createRange.Text = '' then

     ShowMessage('Nothing is selected - ');

 end;

end;