By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,717 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,717 IT Pros & Developers. It's quick & easy.

get word under cursor?

P: n/a
Assume we have this html:

<span>the quick brown fox</span>

and the mouse is hovering over the word "fox". Using javascript, is it
possible to determine the word under the mouse *without* introducing
additional elements such as an anchor?

//undesirable:
<span>the quick brown <a id='fox'>fox</a></span>

Thanks
Timo
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Timo wrote:
<span>the quick brown fox</span>

and the mouse is hovering over the word "fox". Using javascript, is it
possible to determine the word under the mouse *without* introducing
additional elements


No. The browser doesn't know about words. In the browser's object model,
the text node "the quick brown fox" is atomic.

ciao, dhgm
Jul 23 '05 #2

P: n/a


Timo wrote:
Assume we have this html:

<span>the quick brown fox</span>

and the mouse is hovering over the word "fox". Using javascript, is it
possible to determine the word under the mouse *without* introducing
additional elements such as an anchor?


In IE (on Win at least) and in Mozilla browsers it is possible, see
<http://www.faqts.com/knowledge_base/view.phtml/aid/33674>
for details.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.