属性IHtmlElementCollection.all被HTML文件中的脚本标记破坏

时间:2012-02-04 01:33:18

标签: delphi ihtmldocument2

我在使用Delphi XE2的IHtmlElementCollection时遇到了一些麻烦。我的文档看起来像这样,我把它加载到TWebBrowser。

<!DOCTYPE html>
<html>
<head>
<title>Test av skjema</title>
  <script type="text/javascript" src="Header.js" ></script>      
  <style>
    body{ font-family: 'Segoe UI'; font-size: 9pt; }
    table{ background-color: silver; width=98%; }
   td{ background-color: white; vertical-align: top; padding: 2px; }
   .fullWidth{ width: 100%; border: 0px solid white; }
   .noFrame{ border: 0px solid white; overflow: hidden; width=100%; }
   .Header{ font-weight: bold; }
   .Question{ font-size: 9pt }
    .HelpText{ font-size: 8pt; color: navy; }
  </style>
</head>
<body>
<form>
 ...
</form
</body>
</html>

当我尝试使用IHtmlDocument2接口迭代文档中的所有元素时,“all”属性将仅包含脚本之前的元素,总共5个IHtmlElement对象。在那之后,没有更多的元素可以找到。

但是,当我删除标签时:

<script type="text/javascript" src="Header.js" ></script>      

迭代器将再次找到文件的所有元素,这是更多的。有谁知道为什么会这样?

0 个答案:

没有答案