在WebBrowser中获取选定的DOM节点 [英] Get the selected DOM node in WebBrowser

查看:134
本文介绍了在WebBrowser中获取选定的DOM节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在WebBrowser控件中选择网页的一部分时,是否有任何方法来获取选定的DOM节点?

Hi, is there any way to get the selected DOM node when we select a part of a web page in WebBrowser control?

推荐答案

如果我理解正确的话您的意思是用鼠标进行选择,这是剪贴板复制"操作之前执行的操作.问题是:这样的选择不会选择任何特定的节点.它选择其呈现形式而不是DOM的文档片段;这样的选择跨越了不同级别的DOM节点.例如,它可以选择段落的一部分,带有图像的几个嵌套表以及锚点的一部分.我不认为这种选择的整体思想可以反映DOM结构,也不能应用于DOM结构.

—SA
If I understand this right you mean selection with the mouse, something you do before the clipboard "Copy" operation. The problem is: such selection does not select any certain node. It selects a fragment of the document in its rendered form, not DOM; such selection goes across the DOM nodes of different levels. For example, it can select part of paragraph, several nested tables with images and a part of anchor. I don''t think the whole idea of such selection reflects the DOM structure or can be applicable to it.

—SA


这篇关于在WebBrowser中获取选定的DOM节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆