You are here: irt.org | FAQ | JavaScript | Bugs | Q1748 [ previous next ]
Claude Schnéegans writes:
Ok, here is a cure to the resize and lost onMouseDown event blues. In the body tag, define an onResize event handler which will invoke a reset() function to just set onMouseDown to anything for the link. All event handlers are back! In this example I've done it for link #1 but not link #2. onMouseDown events still work after a window resize for link #1, but not for link #2. Note that link #2 will still generate an onMouseDown event on a double click, but not on a single one:
<html> <head> <script language="JavaScript"><!-- function reset() { document.links[0].onMouseDown = ""; } //--></script> </head> <body onresize="reset()"> <a href="javascript:void(0);" onMouseDown="alert('Mouse 1 is down');">Testing 1</a> <br> <a href="javascript:void(0);" onMouseDown="alert('Mouse 2 is down');">Testing 2</a> </body> </html>