或者修改你的.pas文件为
unit pki;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw,MSHTML;
function getInputStr(WB: TWebBrowser; FieldName: String): String;
implementation
function getInputStr(WB: TWebBrowser; FieldName: String): String;
Var
Doc : IHTMLDocument2;
inputText : IHTMLInputTextElement;
begin
Doc := IHTMLDocument2(WB.Document);
if nil <> Doc then
begin
//如果T1不是IHTMLInputTextElement类型将出错
inputText := Doc.all.item(FieldName, 0) as IHTMLInputTextElement;
Result := inputText.value;
end;
end. |