<p>I really <em>like <a href="...">stackoverflow</a></em> a lot.</p> ^...........^ Offset 35 to 48
Given offset 35 (to 48), the function should return the node object of the "a" element. I am wondering whether this is possible at all and, if it is, what would be a good approach to solve this.
Thanks in advance for your efforts!<hr>
Is there a way to highlight text at a given offset in an HTML document with Firefox?
I have a list of offsets and lengths of strings to highlight. I suppose I need to find out the parent element of the text node at the given offset, is this right?
I don't think it should be a problem for me to add the highlighting once I've got the right parent node, since this is simply DOM manipulation.
Do you have any ideas or hints?
<strong>Clarification:</strong> The offsets are relative to the contents of the body tag. Thanks @ Jonathan for pointing this out.
Thank you very much.