获取 Firefox 中显示的网站的特定元素

发布于 2024-09-12 02:43:19 字数 308 浏览 4 评论 0原文

我使用像 SnagIt 这样的屏幕截图工具,该工具能够制作网站内特定元素的屏幕截图。我在 firefox、safari 和 ie 上尝试过这个功能,一切都运行良好。当我使用鼠标指针瞄准某个元素时,SnagIt 在浏览器中悬停的元素周围显示一个红色框。例如,此工具知道 div 或 img 元素的确切坐标。

这个功能背后的技术是什么?每个浏览器都有通用的方法吗?我已经使用 Spy++ 来获取窗口句柄,不幸的是这不是解决方案。

我在一个项目中需要针对不同浏览器的此功能。

非常感谢, 标记

I use a screenshot tool like SnagIt and this tool is able to make a screenshot of a specific element inside a website. I tried this feature with firefox, safari and ie, all runs fine. When I use the mouse pointer to aim an element, SnagIt shows a red box around the hovered element in the browser. For example, this tool knows the exact coordinates of a div or img element.

What is the technique behind this feature? Is there a common way for every browser? I've already used Spy++ to get the window handles, unfortunately this isn't the resolution.

I'm in a project in which I need this feature for different browsers.

Thank you very much,
Mark

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

漆黑的白昼 2024-09-19 02:43:19

如果你想知道javascript中任何元素的x,y坐标,那么我建议你使用jquery [http://jquery。 com] 在您的页面上并使用其偏移功能。

If you want to know the x,y coordinates of any element in javascript, Then I suggest you use jquery [http://jquery.com] on your page and use its offset function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文