• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

mouse event order in IE

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These are the events I am hooking handlers to:
onmouseclick, onmousedblclick and onselectstart.

What I want to achieve is that the user can select text in table cells by double clicking the text thus selecting one word. But not selecting a huge chunk by pressing the SHIFT or CTRL keys, since these keys select the content in a way handled by javascript and table row highlighting, and the standard selection/highlighting of text overcolors my highlighting of the tablecells.

So: only selection through doublecklick.

I thought it would work by something like this:


But it seems as the order of the event handlers being called is weird (to me), namely: 1. onclick, 2. onselectstart, 3. ondblclick. So I don't know how to tell the onselectstart handler that the selection is triggered by a dblclick. How do I achivie this???

Thanks,

Seb

edit: changed keywords to onclic_k... due to forum filter.
[ September 13, 2007: Message edited by: seb petterson ]
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I could achieve this if I can get the object that was clicked (the table cell, or the span element that lays in it and which contains the double clicked text). I have the x y coordinates from the window.event.[x|y] ...anyone knows how to get the object?

Seb
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The target object is in the event instance.
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
The target object is in the event instance.



and how do i access it?
I tried:


also tried:

[ September 13, 2007: Message edited by: seb petterson ]
 
Bear Bibeault
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you are paraphrasing your code, I don't know how you are really invoking your handlers. Please post actual code.
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Because you are paraphrasing your code, I don't know how you are really invoking your handlers. Please post actual code.



the actual code is a bit messy, but this will generate an alert saying undefined:

put anywhere in the script section:


or

or
 
Bear Bibeault
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual pattern for event handlers:



Standards-compliant browsers will pass the event instance as the parameter to the handler. IE sets it as a property on window. The above idiom handles both cases. For real browsers, the target element will be identified as the target property in the event nstance, for IE, srcElement.

Or, you could do what most experienced developers do and employ a robust library such as jQuery or Prototype to handle all the browser differences for you.
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic