Is there a javascript code to locate and highlight a block in a web page corresponding to its dom tree node?
Here I have a dom tree parsed from a html page. I want to select a node in the tree, and highlight its corresponding area in the web page (just like google chrome does, illustrated in the image below). Is there any javascript code to implement this? I tried to wrap the selected tag with a tag, but there are some cases it didn't work. What I need is a general way. Any suggestion would be开发者_运维百科 helpful. Thank you!
I'd probably use a div overlay.
So you'd need to get the node's width, height and offset top and left and then overlay that with a div that has a semi-transparent background-image.
Should be fairly easy to do with jQuery
精彩评论