Marcia Gulesian wrote:
How can I capture the event when I click (focus) with the cursor
anywhere in the
page (that is, on a component or elsewhere). This event would occur in
an I.E 5.5 or later browser.
Hello Marcia,
the event handlers on the body-element will do the job.
http://www.w3.org/TR/html401/struct/...html#edef-BODY
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove,
onmouseout, onkeypress, onkeydown, onkeyup
e.g. <body onclick="your javascript code">
If you need information on the cursor position, look at these Microsoft proprietary
functions:
window.event.clientX
window.event.clientY
They give you screen relative coordinates and need an installed event-handler
e.g.
<script for="document" event="onmousedown()" language="JScript" type="text/jscript">
// your code to handle window.event.clientX and window.event.clientY
// or a function call to handle your needs
</script>
The following ones give parent-element relative coordinates
window.event.x
window.event.y
these are best called by an element event handler
e.g. <div onclick="alert('x/y='+window.event.x+'/'+window.event.y);">click me</div>
For object relative coordinates:
window.event.offsetX
window.event.offsetY
They give the relative coordinates to the up left corner of the object
regards, Michael