473,378 Members | 1,390 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,378 software developers and data experts.

capture event - click anywhere in page

How can I capture the event when I click with the cursor anywhere in the
page (that is, on a component or elsewhere). This event would occure in
an I.E 5.5 or later browser.

Jul 23 '05 #1
3 9944


Marcia Gulesian wrote:
How can I capture the event when I click with the cursor anywhere in the
page (that is, on a component or elsewhere). This event would occure in
an I.E 5.5 or later browser.


if (document.attachEvent) {
document.attachEvent('onclick',
function () {
// handle event here e.g.
alert(event.type + ' for ' + event.srcElement);
}
);
}
should do with IE 5.5/6 (well as far as click events are reported, if
there is a plugin in the page then as far as I remember clicks on the
content the plugin renders are usually not exposed to script in the HTML
page).
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
Thanks.

Martin Honnen wrote:
Marcia Gulesian wrote:
How can I capture the event when I click with the cursor anywhere in the
page (that is, on a component or elsewhere). This event would occure in
an I.E 5.5 or later browser.


if (document.attachEvent) {
document.attachEvent('onclick',
function () {
// handle event here e.g.
alert(event.type + ' for ' + event.srcElement);
}
);
}
should do with IE 5.5/6 (well as far as click events are reported, if
there is a plugin in the page then as far as I remember clicks on the
content the plugin renders are usually not exposed to script in the HTML
page).

--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 23 '05 #3
Martin Honnen wrote:
Marcia Gulesian wrote:
How can I capture the event when I click with the cursor anywhere in the
page (that is, on a component or elsewhere). This event would occure in
an I.E 5.5 or later browser.

if (document.addEventListener)
{
document.addEventListener('click',
function () {
// handle event here e.g.
alert(event.type + ' for ' + event.target);
},
false
);
}
else if (document.attachEvent) {
document.attachEvent('onclick',
function () {
// handle event here e.g.
alert(event.type + ' for ' + event.srcElement);
}
);
}

should do with IE 5.5/6 [...]


And with this addendum it also works in browsers standards compliant in this
regard.
PointedEars
Jul 23 '05 #4

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

Similar topics

3
by: Marcia Gulesian | last post by:
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.
1
by: Sakharam Phapale | last post by:
Hi All, How to capture Mouse Single click and mouse double click event on Commnad Button. I am doing as follows. Private void Button1_MouseUp(Object sender,...
2
by: Don Tucker | last post by:
Sorry, I attempted to tab in the previous post and accidentally posted prematurely. I am trying to use the WebBrowser control from Visual Studio 2005 to load a web page and display its HTML...
1
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
2
by: jw56578 | last post by:
Hi, How would the following be accomplished. I have a parent aspx page, that dynamically loads 3 user controls (through LoadControl) depending on a certain criteria. I want the click of a button...
5
by: ewillyb | last post by:
Hi, ASP.NET has some interesting behavior when the user hits the Enter key. If there are multiple ASP:Buttons (rendered as HTML submits) on the form, when the user hits enter, the first button's...
8
by: Ken Sturgeon | last post by:
I have a button inside a panel control. Apparently I can't expect VB to respond to the button's _Click event. How do I capture the click event? Thanks Ken
2
by: TC | last post by:
Hello, I need to build a very simple text editor. The requirement is that the input screen should be divided into 'm*n' cells ('m' rows, 'n' columns, with each cell of a fixed size). Whenever...
1
by: coolnags | last post by:
Hi, In IE dropdown combo box after expanding the box, if you click anywhere onthe page(empty space, IE toolbar,address bar..etc) it minimizes the opened combo box. what is the event which is doing...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.