473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

capture page-click event

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.

Jul 23 '05 #1
3 2713
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
Jul 23 '05 #2
DU
Michael Schmitt wrote:
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.


In MSIE 6 in standards compliant rendering mode, it will be better to
register event handlers on the root element, not the body.
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
clientX and clientY are browser content area (client area) coordinates.
Screen relative coordinates are given by event.screenX and event.screenY
in MSIE 5+

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
event.x and event.y are mouse coordinates within a relatively positioned
element otherwise within its closest (within the document containment
hierarchy) relatively positioned containing element.

DU
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

Jul 23 '05 #3
Thanks.

Michael Schmitt wrote:
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


Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve High | last post by:
I'm working on an app where a page is created dynamically via a CMS, and I need to save the page similar to the way you can save a 'complete web page' via a browser. I need to save the graphics,...
2
by: aimee | last post by:
Hi. Is there a way to capture the events fired in a PrintDialog? I would like to capture when the user presses "Print" so I can do some cleanup. The asp.net (IE6) application I'm working on has 6...
1
by: Jim Quast | last post by:
I have an ASP page and a CREGReports002.vbs file coded to export data to excel. I do this by building variables in a stored procedure. The ASP page has text boxes, list boxes, and radio buttons. ...
1
by: Hose B | last post by:
HI all, I have a legacy app in which users can pick various page templates. There is a template preview dialog. It works such that they view a list of icons in an asp page that represent each...
4
by: ABC | last post by:
I. I have a video capture project, like AmCap, written in VB.NET. It is a windows applications. Is it possible to put it into a web page? II. Is the conversion in I complicated? Involve ActiveX...
1
by: patrickprog | last post by:
Purpose: Capture a web page listing for a current browser session. The web page will be from an https site, and this site does require a login. Therefore, the site cannot simply be referenced by...
3
by: =?Utf-8?B?Q2hha3JhdmFydGh5?= | last post by:
Hi All, We are working in a web application and we wanted to capture the full webpage into an image file. FULL WEBPAGE means, the page which is below the visibility of the screen and you need...
4
by: DGS | last post by:
Hi guys, Not a developer, but an admin so please pardon my ignorance. I have an issue that I was hoping to get help with. What I need is for the front page of my site to capture the URL that...
1
by: empiresolutions | last post by:
i want to do a screen capture/scrape of a page, resulting in a JPG or PNG that i could save in a dir of my choice. This capture needs to take place a few seconds after the page loads, to allow all...
1
by: Harsha | last post by:
Hi, I am using curl to capture the contents of the web page into a variable, but i am having problems when the url given to curl gets redirected to another page. Please suggest me, is there a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.