• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Two simultaneously fired events

 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends!

We are finding it difficult to separate onclick event of image and onmousedown event of TD on which the image is present. Both these events are getting fired simultaneously.

How can we specify like in the image's area the TD event should not get caught? Or how can we handle this?

Regards,
Leena
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're not giving us much to go on.

If you're not interested in an event, why have a handler for it?
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Thanks Bear your post made me go to the code.
I was trying to get help for a team mate who gave me the earlier explanation.

However, the real problem is in the two mousedown events here..


When user action is mousedown on the image for sort, we dont want the mousedown on the TH to trigger.

Regards,
Leena
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The sortOn handler will need to cancel the event. This is unfortunately a browser-specific action. (unless you are using a library such as Prototype that hides such differences behind a common API).
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In IE, you'll set the cancelBubble propoerty of the event instance to true. In real browsers, you call the stopPropagation() method of the event instance.
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
The sortOn handler will need to cancel the event.



What do you mean by Cancel the event?

Originally posted by Bear Bibeault:
This is unfortunately a browser-specific action. (unless you are using a library such as Prototype that hides such differences behind a common API).



Browser specific action -- are you referring to the way events are handled? The bubbling and opposite model?

I have never heard of the library you mentioned. I will look on the net also. But briefly can you tell me if this is used in any general web application or is it used for special purpose web applications?

Thank you!

Regards,
Leena
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what I need to do is something like the following-



Right?

Regards,
Leena
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Close.



If you're doing anything but the most trivial of Javascript on your pages, libraries like Prototype or jQuery are great tools to have at your disposal to make things such as this (and a lot else) easier.
reply
    Bookmark Topic Watch Topic
  • New Topic