我作过,是用delphi实现的.
1。
看看我这个程序,对你应该有用处:
procedure TMainform.getyear;
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i,j,X,l: integer;
vi: OleVariant;
IE1: IWebBrowser2;
IDoc1: IHTMLDocument2;
iELC : IHTMLElementCollection ;
S,S2 : string;
HtmlSelEle : IHTMLSelectElement;
htmloption: IHTMLOptionElement;
op:Ihtmlelement;
begin
try
idoc1:=Web.Document as IHTMLDocument2;
ielc:=idoc1.Get_all;
j:=0;
while j<ielc.length-1do
begin
Application.ProcessMessages;
spDisp := ielc.item(J, 0);
if SUCCEEDED(spDisp.QueryInterface(IHTMLselectelement ,HtmlSelEle))then
with HtmlSelEledo
begin
if name='nian' then
begin
for l:=0 to length-1do
begin
remove(0);
j:=j+1;
end;
adq.Close;
adq.SQL.text:='select n from lw group by n';
adq.Open;
while not adq.Eofdo
begin
op:=idoc1.createElement('OPTION');
op.setAttribute('aaa','bbb',0);
htmloption:=op as ihtmloptionelement;
htmloption.text:=adq.fieldbyname('n').asstring;
htmloption.value:='mynianchange/'+adq.fieldbyname('n').AsString;
add(op,htmlselele.length);
adq.Next;
j:=j-1;
end;
htmlselele.selectedIndex:=0;
end;
if name='qi' then
begin
for l:=0 to length-1do
begin
remove(0);
j:=j+1;
end;
adq.Close;
adq.SQL.text:='select q from lw where n=(select min
from lw) group by q';
adq.Open;
while not adq.Eofdo
begin
op:=idoc1.createElement('OPTION');
op.setAttribute('aaa','bbb',0);
htmloption:=op as ihtmloptionelement;
htmloption.text:=adq.fieldbyname('q').asstring;
htmloption.value:='myqichange/'+adq.fieldbyname('q').AsString;
add(op,htmlselele.length);
adq.Next;
j:=j-1;
end;
htmlselele.selectedIndex:=-1;
end;
end;
j:=j+1;
end;
except
end;
exit;
end;
2.具体思路就是在查询按钮的onclick事件让其跳转到一特定url,然后在浏览器控件
的onbeforenavigator2事件中截获之......