Friday, 13 November 2009

onclick vs. onmousedown and onmouseup

I've been trying for the last couple of hours as to why I couldn't select a row in my GridView using right click... it seemed to work fine for left click, but right click had issues (I had my attribute for the row set to 'onclick')

What I was doing so making a context menu appear, but I wanted the row to select itself before the menu appeared. After many vain attempts of simulating left click behaviour, adding pointers to the left clicks behaviour into the code... I simply changed the attribute to onmouseup, and presto! it works!

strange, but I do recall when attemping to disable right clicks on webpages, the onmousedown/up event is captured, so it must be how the browser interprets the keypresses for each.

No comments: