也就是相应网页上的按钮了;
以前下过一个例子,关于webbrower的
<area shape="rect" coords="629,430,747,465" href="Email_" alt="发邮件" >
<area shape="rect" coords="465,243,608,362" href="photo2_" alt="照片二" >
<area shape="rect" coords="243,235,383,368" href="photo1_" alt="照片一" >
<area shape="rect" coords="20,323,138,358" href="button4_" alt="按这里退出程序" >
<area shape="rect" coords="20,267,138,302" href="button3_" alt="这是按钮三" >
<area shape="rect" coords="24,217,142,252" href="button2_" alt="这是按钮二" >
<area shape="rect" coords="24,166,142,201" href="button1_" alt="这是按钮一" >
delphi中的关键代码:
procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin
If Pos('button1_', URL)>0 Then
Begin
ShowMessage('你选择了按钮一!');
Cancel:=True;
End;
If Pos('button2_', URL)>0 Then
Begin
ShowMessage('你选择了按钮二!');
Cancel:=True;
End;
If Pos('button3_', URL)>0 Then
Begin
ShowMessage('你选择了按钮三!');
Cancel:=True;
End;
If Pos('button4_', URL)>0 Then close;
If Pos('photo1_', URL)>0 Then
Begin
ShowMessage('你选择了图片一!');
Cancel:=True;
End;
If Pos('photo2_', URL)>0 Then
Begin
ShowMessage('你选择了图片二!');
Cancel:=True;
End;
If Pos('Email_', URL)>0 Then
Begin
ShowMessage('发邮件!');
Cancel:=True;
End;
end;