EVENT
HANDLER: onMouseUp
onMouseUp
= myJavaScriptCode
Event handler for Button, Document,
Link
The onMouseUp event handler is used to execute specified JavaScript
code whenever the user releases the mouse button. It uses the following
properties of the Event object:
type - indicates the type of event.
target - indicates the target object to which the event was sent.
layerx, layerY, pageX, pageY, screenX, screenY
indicate the cursor position at the time of the MouseUp
event.
which - represents 1 for a left-mouse-button up, and 3 for a
right-mouse-button up.
modifiers - indicates any modifier keys held down when the MouseUp
event occurred.
For example, with the following code, the user can click on the word
'green' to alter the background color to green. Releasing the mouse
calls the 'changeColor' function to do this:
Code:
<P>Click on <B><A onMouseUp="changeColor()">
green</A></B> to change background color.</P>
NOTE:
When an OnMouseUp returns false, such as over an armed link (a MouseDown
over a link causes it to become armed), the default action is canceled.
This also happens with a MouseUp over an unarmed link. To illustrate
this, the following example assumes that a particular link 'lostLink'
is no longer available, so when the user clicks on that link, the release
of the mouse button calls the 'myAlert' function and causes the link
not to be triggered.
Code:
<P>Go to <A href="lostLink.html" onMouseUp="myAlert()">MyLink</a>.
</P>
|