capture event - click anywhere in page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcia Gulesian

    #1

    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.

  • Martin Honnen

    #2
    Re: capture event - click anywhere in page



    Marcia Gulesian wrote:
    [color=blue]
    > 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.[/color]

    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/

    Comment

    • Marcia Gulesian

      #3
      Re: capture event - click anywhere in page

      Thanks.

      Martin Honnen wrote:
      [color=blue]
      > Marcia Gulesian wrote:
      >[color=green]
      > > 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.[/color]
      >
      > 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/[/color]

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: capture event - click anywhere in page

        Martin Honnen wrote:[color=blue]
        > Marcia Gulesian wrote:[color=green]
        >> 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.[/color]
        >[/color]
        if (document.addEv entListener)
        {
        document.addEve ntListener('cli ck',
        function () {
        // handle event here e.g.
        alert(event.typ e + ' for ' + event.target);
        },
        false
        );
        }
        else[color=blue]
        > 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 [...][/color]

        And with this addendum it also works in browsers standards compliant in this
        regard.


        PointedEars

        Comment

        Working...