一下代码在2000下运行通过,但是到XP下出“拒绝访问”的错误
var
  i,j:integer;
begin
  OutMemo.Clear;
  i:=WEB.oleobject.document.documentelement.document.frames.length;
  OutMemo.Lines.Add('have Frames: '+inttostr(i));
  for j:=0 to i-1 do
  begin
  OutMemo.lines.add('');
  OutMemo.Lines.Add('Frame '+inttostr(j+1)+' from here');
  OutMemo.Lines.Add(WEB.oleobject.document.
                documentelement.document.frames.item(j).document.
                documentelement.innerHtml);//取得每个Frame中的HTML内容
  end;
end;WEB访问的页面的HTML内容为:
<HTML>
<body>
aaaaaaaaaaaaaa
<iframe Src="http://localhost/" width=300 height=200 Name="Page1"></iframe>
<iframe Src="about:blank" width=300 height=200 Name="Page2"></iframe>
</body>
</html>跟踪了一下,如果WEB.oleobject.document.documentelement.document.frames.item(j).document就这一项出错。
但是能够访问Page2也就是Frames.items(1)的内容如果把HTML换成两个iframe的src都换成about:blank,程序就不会有问题。开发环境:Delphi 7 , XP SP2
在2000下运行没问题,真是郁闷。XP SP1运行同样要出错。