onclick override to top layer? [Archive] - XML Elves

onclick override to top layer?

surfer97301
08-08-2004, 08:59 PM
Hi,

Basically I have a background canvas that is the whole userspace. It has an onclick method which causes a rectangle to be place on the top layer. This rectangle has an onclick method that causes a circle to be place inside the rectangle.

When I click the rectangle, the rectangle onclick event is fired followed by the canvas onclick method. What can I do to prevent the canvas onclick method from being called?

Is there an easy way to do this?

Thanks for any tips !!

Anonymous
08-09-2004, 03:45 AM
In your script for click on rectangle or circle add
evt.stopPropagation ()

So event will not go to canvas - I presume that canvas is parent of rectangle ...

Michel

surfer97301
08-09-2004, 11:31 AM
Oh ok. I temporarily stopped the click event by checking the evt.target.getNodeName() inside the canvas onclick event and returning if it was not the canvas but your method looks to be a lot cleaner.

Thanks again!

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum