Getting the coordinates of a piece of text with Javascript?



Hi,

I would like to find the coordinates of a word inside a div or span
tag. I know you can find the coordinates of a tag inside the DOM, but
can you get the coordinates of a portion of the text inside that
element in javascript?


If the user highlights or selects text in a div or span can I get the
indicies that make up that selected piece of text? What API of
javascript do I use to find that out? Or really is there a way in
javascript to interact with the browsers text selection?


Thanks
Charlie

.



Relevant Pages

  • Re: Hide/Show Selection List
    ... A div is a BLOCK element, meaning that is rectangle with some content. ... a SPAN is an inline element, eg a part of a sentence. ... For span you should use inline. ... you are using a suspect/bad way to invoke a javascript function. ...
    (comp.lang.javascript)
  • Re: Hiding
    containing tags onmouseout
    ... I've been using a button but I think I'd prefer this RHSBox ... Where (not on my w3shools <span> tag page) can I find all of the ... coordinates while DIV is visible/invisible then that's up to them also. ...
    (comp.lang.javascript)
  • Re: CSS positioning pickle
    ... from a vertical tag. ... I have a piece of javascript that grabs the ... this <span> only displays on mouseover. ...
    (comp.infosystems.www.authoring.html)
  • Re: How do draw new window immideately?
    ... complete write out some javascript that will hide that <DIV> tag ... Michael ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Extract specific div element from page
    ... Or you could just use Javascript combined with PHP, just use javascript it's something like this document.getElementById('tagId').innerHtml that will give you the htmlof the <div> tag you specify. ... Group Members Site Fully Operational ...
    (php.general)