Do you know the most efficient way to highlight word and add onmouseover event?
I have text and I want to make somekind of word explanation field, so when user put his cursor on the word, I call AJAX to dictionary and show him meaning.
I have two ideas:
1) Before showing text, put each word to <span onmouseon="my_foo("word");">
wrapper.
For example:
<span onmouseon="my_foo("Hello");">Hello</span>
<span onmouseon="my_foo("world");">world</span>
But I think this will seriously overload the page.
2) When user hold cursor for more than 0.5 sec in one area, I get pointer coordinates, calcuate what word is shown (I do not know if is possible) and do AJAX call.
What do you think is better, more easier to code?