问题标签 [ihtmldocument]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
vba - VBA GetElementsById Method "Object Variable Not Set"
I'm trying to select the main menu ID of this page http://greyhoundstats.co.uk/index.php labeled ("menu_wholesome")
in order to get their hyperlinks later on. In the HTML document, there are two tags with this ID, a <div>
and its child element <ul>
, but when i search for them with the code below, i get the object variable not set" error.
Anyone knows why getElementsById can't find the refered ID, although it is part of the HTML document set? I know that this method is supposed to return a unique ID, but when we have the same one refered by other tags i also know that i will return the first ID found which should be the <div id="menu_wholesome">
part of the HTML page being requested.
c# - 如何将 doctype 解析为字符串作为 html doctype
我正在开发 C# 应用程序以通过EnumWindows从当前 IE 选项卡获取 html 文件。现在我得到了 HTMLDocument 并可以通过HtmlAgilityPack将其从 outerHTML ( {HTMLDocument}.documentElement.outerHTML )解析为 html 文件,但我的输出 html 文件没有 doctype。
我看到HTMLDocument具有doctype属性,如何将其解析为与 html 文件中的标记相同的字符串
html - VBA HTML将输入元素添加到Span
原始资料:
我正在尝试使用 VBA 处理 Internet Explorer 会话。
当单击 div 元素时,网站的 HTML 使用一些后台程序添加输入复选框,而不是原生输入复选框。当被触发时,后台进程会在表单底部的 span 中添加一个 input 元素。因为我不能直接与 psuedo-checkbox div 元素交互并使用 .click 触发进程,所以我试图将我知道的结果输入元素添加到表单底部的 span 中。
示例 HTML:
我相信我需要在跨度上使用 .appendChild() 但我无法在这方面取得任何进展。遍历页面的其余部分并获取设置输入元素所需的信息的一切都很好。我只需要以某种方式将输入元素添加到跨度。
添加信息
VBA:
HTML:
c# - C# 难以访问 HTML DOM 元素
我正在尝试从网站访问一个元素,但是它没有返回完整的元素。
两者idDooOuter
和target1Outer
都没有从 中返回后代元素dooplay_player_response
,这将是class="pframe"
.
我尝试过使用FindByClassName()
功能,但无法访问此元素。我的目的是在iframe
. 有人可以帮我解决这个问题吗?
编辑:观察。我尝试使用其他编程语言,例如 Java、Python、javascript (Tampermonkey) 和 C++,结果都一样,我无法获取此元素。
delphi - 将 IHTMLDocument2 实例分配给 TWebBrowser 实例
我正在使用该IHTMLDocument2
接口的一个实例来解析一些 HTML,如本文所述:
从 IPersistMoniker 加载需要很长时间才能加载无法解析的 URL
代码比较简单:
完成后,我保存diDoc2
上面新修改的 HTML 内容并将 HTML 加载到TWebBrowser
.
我是否可以将
IHTMLDocument2
上面已经解析的内容直接“分配”给IHTMLDocument2
包含在 中的内容TWebBrowser
,这似乎是一种更快的方法。我可以使用可能IHTMLDocument2.write
或其他方法来做到这一点,但是如果首先可能的话,可能会比简单地分配一个指向已经初始化的对象的指针有一些性能损失。换句话说,我只是想“显示”/“渲染”我刚刚在排序的“后台缓冲区”中解析的内容。是否需要打电话
CoInitialize
和打电话CoUninitialize
之前和之后CoCreateInstance
?我见过一些代码可以做到这一点,但没有它也可以工作,除非 Delphi/C++ Builder 做一些底层初始化。