提交表单可以直接用现成的方法!var Doc:IHTMLDocument2; Form:IHTMLFormElement; begin Doc:=Webbrowser1.Document as IHTMLDocument2; Form:= Doc.all.item('Login',0) as IHTMLFormElement; Form.Submit; end;var Doc:IHTMLDocument2; Button:IHTMLElement; begin Doc:=Webbrowser1.Document as IHTMLDocument2; Button:= Doc.all.item('MyButton',0) as IHTMLElement; //如果name和id不存在,即tagName不存在,就要将'MyButton'换成相应序号数字! Button.click; end;调用脚本! var Doc:IHTMLDocument2; Scripts:IHTMLScriptElement; begin Doc:=Webbrowser1.Document as IHTMLDocument2; Scripts:=Doc.scripts.item(0,0) as IHTMLScriptElement; //Scripts.text可获得脚本内容,Doc.scripts.Length长度,可用于遍历所有脚本! end;解释脚本可以用MS提供的Script Control!
插入HTML不可以吗,写上“ONCLIEK=ADD()”
add()为javascript 函数!
Doc:IHTMLDocument2;
Form:IHTMLFormElement;
begin
Doc:=Webbrowser1.Document as IHTMLDocument2;
Form:= Doc.all.item('Login',0) as IHTMLFormElement;
Form.Submit;
end;var
Doc:IHTMLDocument2;
Button:IHTMLElement;
begin
Doc:=Webbrowser1.Document as IHTMLDocument2;
Button:= Doc.all.item('MyButton',0) as IHTMLElement;
//如果name和id不存在,即tagName不存在,就要将'MyButton'换成相应序号数字!
Button.click;
end;调用脚本!
var
Doc:IHTMLDocument2;
Scripts:IHTMLScriptElement;
begin
Doc:=Webbrowser1.Document as IHTMLDocument2;
Scripts:=Doc.scripts.item(0,0) as IHTMLScriptElement;
//Scripts.text可获得脚本内容,Doc.scripts.Length长度,可用于遍历所有脚本!
end;解释脚本可以用MS提供的Script Control!