How to make transparent background clickable?

There are some transparent areas in my gadget background, because my boss think it's cool... which treat me crazy, becasue all transparent areas are not clickable, and when i move mouse from non-transparent area into transparent area, event onmouseout is fired. Is there any method can make it clickable and not fired onmoustout?
[330 byte] By [JohnHax] at [2008-2-4]
# 1
Unfortunately not. You've got two choices:

1. Tell the boss it can't be transparent

2. Within the onmouseout event code, check the event.screenX / event.screenY to see if they've actually left the bounding area of the Gadget - which can be found from window.screenLeft and window.screenTop

The problem with option 2 is (I suspect) the event won't fire when the mouse does actually leave the Gadget, as technically it's already left it. Creating an onmousemove event won't work either, as it will only fire when the mouse is within the Gadget non-transparent region.

I'd go with option 1 personally!

JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 2

no way... event.x = event.y = -1 when onmouseout and onmouseleave...

JohnHax at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 3

Oh, maybe i found the workaround....

window.attachEvent('onload', init);

function init() {

trace('init');

document.body.attachEvent('onmouseenter', test);

document.body.attachEvent('onmouseleave', test);

}

function test(event) {

trace(event.type + '@' + event.x + ',' + event.y);

if (event.type == 'mouseover' || event.type == 'mouseenter') {

document.body.setCapture();

} else if (event.type == 'mouseout' || event.type == 'mouseleave') {

document.body.releaseCapture();

}

}

JohnHax at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...