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.