Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

EricBrian

macrumors 6502a
Original poster
Jul 30, 2005
657
8
So, I have this layer that is 400px by 200px. I need to know if the user clicks outside of this layer. Anybody have a link to a page that explains how to trap that click?

Thanks. :)
 
You may want to look up event delegation for JavaScript. You might be able to utilize it for this. You can just place a onclick event for the document.window and see if a click in your area also occurs at that same time. A trickier method would involve capturing the 4-corners of your area and find the mouse coordinates and do some simple math to see if you're inside the box.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.