Javascript:让用户选择像Firebug这样的HTML元素? [英] Javascript: Let user select an HTML element like Firebug?

查看:117
本文介绍了Javascript:让用户选择像Firebug这样的HTML元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个需要在网页上选择元素的浏览器(Chrome / FF)扩展。我希望它像Firebug的元素检查员一样。您单击检查箭头,然后可以悬停/突出显示元素。当您单击所需的元素时,会检查元素。我只是对代码感兴趣,允许用户选择一个元素 - 不是在实际检查它或类似的东西。

I want to write a browser (Chrome/FF) extension that needs to select an element on a web page. I would like it to behave like Firebug's element inspector does. You click the inspect arrow and you can then hover/highlight elements. When you click on the element you want, the element is inspected. I'm just interested in the code to allow a user to select an element - not in actually inspecting it or anything similar.

因为我正在写一个扩展名可能会很好,如果你可以提供非jQuery / Prototype / etc ..代码,所以我不必分发。

Because I'm writing an extension, it might be nice if you could provide non-jQuery/Prototype/etc.. code so I don't have to distribute that.

推荐答案

p>我使用jQuery作为另一个项目的一个组件来编写一个这样的实现。来源和文档可在这里获得: https://github.com/andrewchilds/jQuery.DomOutline

I wrote an implementation of this using jQuery as a component of another project. The source and documentation are available here: https://github.com/andrewchilds/jQuery.DomOutline

这篇关于Javascript:让用户选择像Firebug这样的HTML元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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