'payFeeOnlineInfo.payFee'是文本框的id var Doc:IHTMLDocument2; userinputelement:ihtmlinputelement; begin Doc:=WebBrowser1.document as ihtmldocument2; if doc=nil then exit; userinputelement:=(doc.all.item('payFeeOnlineInfo.payFee',0) as ihtmlinputelement); userinputelement.value:='aaaaaaaaaaaaa'; end;
[/] uses MSHTML;在窗体中加入webbrowser控件,使用Navigate方法载入网页WebBrowser1.Navigate('c:\index.htm');使用如下代码设置网页input的值((WebBrowser1.Document as IHTMLDocument2).all.item('t1',0) as IHTMLElement).setAttribute('value','abc',1); //t1是网页input的id或name //value表示input的value属性 //abc是要设置的字符串值
Doc:IHTMLDocument2;
userinputelement:ihtmlinputelement;
begin
Doc:=WebBrowser1.document as ihtmldocument2;
if doc=nil then exit; userinputelement:=(doc.all.item('payFeeOnlineInfo.payFee',0) as ihtmlinputelement);
userinputelement.value:='aaaaaaaaaaaaa';
end;
uses MSHTML;在窗体中加入webbrowser控件,使用Navigate方法载入网页WebBrowser1.Navigate('c:\index.htm');使用如下代码设置网页input的值((WebBrowser1.Document as IHTMLDocument2).all.item('t1',0) as IHTMLElement).setAttribute('value','abc',1);
//t1是网页input的id或name
//value表示input的value属性
//abc是要设置的字符串值