LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[CLUG] Javascript

[CLUG] Javascript

Peter Flynn peter at silmaril.ie
Wed Jun 9 19:56:44 IST 2004


On Tue, 2004-06-08 at 23:46, adam beecher wrote:
> I think the answer is "yes and no", or more accurately "yes, but only with
> certain browsers, and it would be ki-hinda tricky". (I just watched
> Scrubs, sorry Janet.)
> 
> In /theory/, you're supposed to be able to drill right down to the
> sedimentary posterior of a document with the DOM (Document Object Model),

I think the problem is that an arbitrary stretch of user-highlighted
text isn't addressable using DOM technology.

> so in /theory/ it should be possible to use an event handler (onClick,
> onMouseDown, etc) to discover where you are in the DOM, convert the
> relevant element into a string, and then the rest would be easy-peasy.

If it was DOM-bound it would be easy.

> However I don't know how to do that; and neither does Internet Explorer,
> so if the function had to be cross-browser, you'd need to delve into the
> pretty world of MSDN.

I don't think I wish to know about that :-)  Strange that after a decade
of the Web, you can't double-click a word and send it to a dictionary:-)
Instead, you have to copy and paste it into a separate page/window/form.

> Now if each word had an individual identifier (<span
> id="word3">word3</span>) it would be way easier, but obviously that would
> make your load time a /wee/ bit heavier, 

That would defeat the objective, which is to let the user highlight a
word or phrase in mid-para, by definition *not* markup up in any way.

> Have a look through a few of these for a bit more info on DOM granularity
> (word of the month), particularly the one on the Mozilla site about
> halfway down and the one with W3C in the title towards the bottom.
> 
> http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=dom+word+click

Some useful references, thanks. If the W3C wasn't in Microsoft's pocket
this would all have been sorted long ago.

///Peter





More information about the Cork mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell