I have a TEXTAREA element. A user right clicks within in to get the
context menu and they select "paste". I want my javascript code to
know that they selected "paste".
I know you can capture the mouse click, but can we capture exactly what
event that attempted?
I 'ld say you should use as much event handlers as possible then. The
following could be a start (but not complete!):
<script type="text/javascript">
function updateBox(nr) {
document.forms[0].howmany.value = nr
}
</script>
<form method="get">
<textarea name="txt" cols="30" rows="5"
onclick="updateBox(this.value.length)"
ondblclick="updateBox(this.value.length)"
onmousedown="updateBox(this.value.length)"
onmouseup="updateBox(this.value.length)"
onmouseover="updateBox(this.value.length)"
onmousemove="updateBox(this.value.length)"
onmouseout="updateBox(this.value.length)"
onkeypress="updateBox(this.value.length)"
onkeydown="updateBox(this.value.length)"
onkeyup="updateBox(this.value.length)"
onfocus="updateBox(this.value.length)"
onblur="updateBox(this.value.length)"
onselect="updateBox(this.value.length)"
onchange="updateBox(this.value.length)"</textarea><br>
Length:
<input type="text" size="4" name="howmany" value="0">
</form>
Further handlers:
http://www.w3.org/TR/DOM-Level-2-Events/events.html
http://msdn.microsoft.com/workshop/author/dhtml/reference/events.asp
http://developer.mozilla.org/en/docs/DOM:element#Event_Handlers
I would just put them all in the code. Brute force, you know