我正在使用此代碼填寫一些網頁的領域,使用WebBrowser控件:我的代碼無法找到場(德爾福 - 的Webbrowser)
procedure TFrmMain.SetValue(const document: IHTMLDocument2;
const formNumber: Integer;
const fieldName, newValue: string);
var
form: IHTMLFormElement;
field: IHTMLElement;
begin
form := WebFormGet(formNumber, document);
field := form.item(fieldName, '') as IHTMLElement;
if field = nil then
exit;
if field.tagName = 'INPUT' then (field as IHTMLInputElement)
.value := newValue
else if field.tagName = 'SELECT' then (field as IHTMLSelectElement)
.value := newValue
else if field.tagName = 'TEXTAREA' then (field as IHTMLTextAreaElement)
.value := newValue;
end;
但「的SetValue」方法不能填寫領域爲此網頁! : http://commenting.iranblog.com/services/commenting/commenting.aspx?BlogID=67436&PostID=754352
SetValue(W.document as IHTMLDocument2, 0, 'name', 'ThisIsANewValueForField');
事實上,我認爲這個網頁的驗證碼無法找到字段名,但我不知道原因!
發生了什麼或沒有發生什麼? – 2010-08-19 15:53:28
有趣的縮進... – 2010-08-19 16:14:01