473,734 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9967


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.attac hEvent) {
document.attach Event('onclick' ,
function () {
// handle event here e.g.
alert(event.typ e + ' for ' + event.srcElemen t);
}
);
}
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.attac hEvent) {
document.attach Event('onclick' ,
function () {
// handle event here e.g.
alert(event.typ e + ' for ' + event.srcElemen t);
}
);
}
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.addEv entListener)
{
document.addEve ntListener('cli ck',
function () {
// handle event here e.g.
alert(event.typ e + ' for ' + event.target);
},
false
);
}
else if (document.attac hEvent) {
document.attach Event('onclick' ,
function () {
// handle event here e.g.
alert(event.typ e + ' for ' + event.srcElemen t);
}
);
}

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
2733
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
14726
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, System.Windows.Forms.MouseEventArgs e) {
2
7951
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 content in a text box on a Form of a Windows Application. I have a button on the Form that invokes the following code when clicked: webBrowser1.Url = new Uri("http://www.microsoft.com"); textBox1.Text = webBrowser1.DocumentText;
1
3088
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 void Page_Load(object sender, System.EventArgs e) { Page.RegisterHiddenField("__EVENTTARGET","SomeButtonOnThePage");
2
2812
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 on one user control to make another user control invisible. How can the parent aspx page capture that click event so that it can know to do something. thanks
5
3133
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 click event will fire and the page will submit. I have a series of pages with Previous and Next navigational Btns. The Previous button is the first button, so when the user hits enter, the previous page is served up. Enter should result in...
8
2581
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
5026
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 the user wants to input text, he will click on one of these cells, and then enter the text. The text should then be visible inside the cell. From my very limited knowledge of VB, I plan to use the 'group box' construct to denote one cell. Now,...
1
1546
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 the act. Can we capture the same event to minimize the custom menu displayed in the html page? Thanks, Nags
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.