hllu:
我把你的代码抄了上去,发现下面这句话有错:
framedoc:=doc.frames.item(i).document as IHTMLDOCUMENT2; *
[Error]main_form.pas(401):Types of actual and formal var parameters must be identical
[Error]main_form.pas(401):Operator not applicable to this operand type
我的源代码是:
procedure TmainForm.javarunClick(Sender: TObject);
var
doc,framedoc:IHTMLDocument2;
all:IHTMLElementCollection;
item,itemc
levariant;
I:Integer;
begin
doc:=wb_main.document as IHTMLDocument2;
if doc.frames.length <> 0 then begin
for i:=1 to doc.frames.length -1 do begin
framedoc:=doc.frames.item(i).document as IHTMLDOCUMENT2;
showmessage(inttostr(i));
end;
end;
end;
(1)怎样改???
^^^^^^^^^^^^
如果去掉*的那一段代码,用一个下面的网页测试,结果发现showmessage只执行了一次。(2)为什么???
^^^^^^^^^^^^
(3)Frames.item(i)的顺序是否与Frame网页上指定的网页的顺序一样???
<Html>
<head>
<Title> Delphi </title>
<meta name="keywords" content="Delphi,inprise,borland,java">
<style type="text/css">
<!--
a:hover { font-family: ""; text-decoration: underline; color: #FF3300}
font { font-family: "宋体"; font-size: 9pt}
a { font-family: ""; text-decoration: none}
-->
</style>
</head>
<FRAMESET ROWS="100%" COLS="18%,*" BORDER=0>
<FRAME NAME="MenuFrame" SRC="./menu.htm" SCROLLING="AUTO">
<FRAME NAME="ContFrame" SRC="./Main.htm" SCROLLING="AUTO">
</FRAMESET>
<NOFRAMES>
如果你看到这一行方字,那么你的浏览器不支持FRAME.
</NOFRAMES>
</html>
另外,我查过MSDN中的IHTMLDocument2部分发现没有它的属性的介绍。