关于向html发送内容的问题(分不够再加)急…………(100分)

  • 主题发起人 主题发起人 chatopsoft
  • 开始时间 开始时间
C

chatopsoft

Unregistered / Unconfirmed
GUEST, unregistred user!
<SELECT class=input1 name=language>
<OPTION selected value=1>英 → 汉</OPTION>
<OPTION value=3>汉 → 英</OPTION>
</SELECT>

以上是网页内的内容

代码这样写为什么会出错?

if (doc.all.item(i).tagName = 'SELECT ')and //一定大写
(doc.all.item(i).name='language')then
begin
p:=combox.ItemIndex+1;
if p=1 then
begin
doc.all.item(i).value:=p;
end
else
begin
doc.all.item(i).value:=3;
end;
请大家帮我看看
出错内容是这样的
project xxxxx.exe raised exception class EaccessViolation
with message 'Access violation at address 004A8137 in module
'xxxxxx.exe'. Read of address 00000000'.Process stopped.Use or
Run to continue.
 
不确定你在说什么,错误信息提示的好象是说对象不存在。什么对象?那个 doc ?
 
看代码

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
i:integer;
doc: OleVariant;
p:integer;
begin
doc:=(sender as TWebBrowser).document;
For i:=0 To doc.all.length-1 do
begin
if (doc.all.item(i).tagName = 'TEXTAREA')and //一定大写
(doc.all.item(i).name='content')then //大小写与原文一致
doc.all.item(i).value:=memo.Lines.Text;
/////////////////////////////////////////////上面通过,可以正常传递////////////
end;
if (doc.all.item(i).tagName = 'SELECT')and //一定大写
////////////////////////////就这段通不过!////////////////////////////////
(doc.all.item(i).name='language')then
begin
p:=combox.ItemIndex+1;
if p=1 then
begin
doc.all.item(i).value:=p;
end
else
begin
doc.all.item(i).value:=3;
end;
end;
/////////////////////////////下面的也通过/////////////////////////
if (doc.all.item(i).tagName = 'INPUT')and //一定大写
(doc.all.item(i).name='submit')and //大小写与原文一致
(doc.all.item(i).value='提交)then
begin
end;
end;
 
倒低有没有人知道呀?
 
通不过的那段的 i 是怎么回事情?
 
combox.ItemIndex 如果 combox 为空时,好象是 -1 吧?其他还真看不出问题来。:-(
 
可是combox是有内容的
 
看看这段代码,这是一段通过新浪发送手机短消息的代码,也是用同样的方法写的!
这段可以,可是上面一段却不行!
我刚才又测试了一下,发现submit,提交也不行,心烦呀!!!

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
i,ok:integer;
doc: OleVariant;
begin
doc:=(sender as TWebBrowser).document;
ok:=0;
For i:=0 To doc.all.length-1 do
begin
if (doc.all.item(i).tagName = 'TEXTAREA')and //一定大写
(doc.all.item(i).name='msg')then //大小写与原文一致
begin
doc.all.item(i).value:=DeleteCR(Memo1.lines.text);
inc(ok);
end;
if (doc.all.item(i).tagName = 'INPUT')and //一定大写
(doc.all.item(i).type='text')and //大小写与原文一致
(doc.all.item(i).name='mob1')then
begin
doc.all.item(i).value:=edit1.text;
inc(ok);
end;
if (doc.all.item(i).tagName = 'INPUT')and //一定大写
(doc.all.item(i).type='text')and //大小写与原文一致
(doc.all.item(i).name='user')then
begin
doc.all.item(i).value:=edit3.text;
inc(ok);
end;
if (doc.all.item(i).tagName = 'INPUT')and //一定大写
(doc.all.item(i).type='password')and //大小写与原文一致
(doc.all.item(i).name='passwd')then
begin
doc.all.item(i).value:=edit2.text;
inc(ok);
end;
if (doc.all.item(i).tagName = 'INPUT')and //一定大写
(doc.all.item(i).type='submit')and //大小写与原文一致
(doc.all.item(i).value=' 发送 ')then
begin
if ok=4 then doc.all.item(i).click;
inc(ok);
if ok=5 then
begin
if edit3.text<>'' then
if edit1.text<>'' then
if edit2.text<>'' then
if memo1.text<>'' then
showmessage('发送成功(不太准确)');
end
else
begin
end;
end;
end;

end;
 
我听说idhttp可以做到我的要求,请问一下那里有下载?
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部