Access browser menu (copy/paste) from Javascript

Discussion in 'Javascript' started by Bani, Mar 31, 2005.

  1. Bani

    Bani Guest

    Is it possible to get browser-menu events (IE) into Javascript?

    I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v). Now
    the users would like to trigger it also from the browser menu.
     
    Bani, Mar 31, 2005
    #1
    1. Advertising

  2. Bani

    Matt Kruse Guest

    Bani wrote:
    > I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v).
    > Now the users would like to trigger it also from the browser menu.


    <body onCopy="myfunc()" onPaste="myfunc2()">

    --
    Matt Kruse
    http://www.JavascriptToolbox.com
     
    Matt Kruse, Mar 31, 2005
    #2
    1. Advertising

  3. Bani

    McKirahan Guest

    "Bani" <> wrote in message
    news:...
    > Is it possible to get browser-menu events (IE) into Javascript?
    >
    > I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v). Now
    > the users would like to trigger it also from the browser menu.
    >


    What do you mean by "browser menu"?

    Browsers have Cut, Copy, and Paste functions under "Edit" on the Menu Bar.

    Or do you mean the right-click context menu?
     
    McKirahan, Mar 31, 2005
    #3
  4. Bani

    Bani Guest

    I haven't seen this two event-handlers in my documentation. But it
    works!

    Thank you.

    Does it work also for other browsers then IE?
     
    Bani, Mar 31, 2005
    #4
  5. Bani

    McKirahan Guest

    "Bani" <> wrote in message
    news:...
    > I haven't seen this two event-handlers in my documentation. But it
    > works!
    >
    > Thank you.
    >
    > Does it work also for other browsers then IE?
    >


    It works for me under FF and NS6.2.
     
    McKirahan, Mar 31, 2005
    #5
  6. Bani

    Csaba Gabor Guest

    Are you sure about that? onPaste has been logged as a Mozilla bug
    at https://bugzilla.mozilla.org/show_bug.cgi?id=280683
    (you can, however, mostly monitor a textbox/textarea for change in
    FF though the buggy method at
    https://bugzilla.mozilla.org/show_bug.cgi?id=285272)

    Also, I just tried the snippet below in my Firefox 1.0.1+ and got
    no alert boxes vs both alert firing for IE 6 (on my Win XP Pro).


    <body onpaste="alert('Body paste')">
    <form name=mine method=get action=''>
    <input name=tbtest onpaste="alert('Input paste')">
    </form>
    </body>

    Csaba Gabor from Vienna

    McKirahan wrote:
    > "Bani" <> wrote in message
    > news:...
    >
    >>I haven't seen this two event-handlers in my documentation. But it
    >>works!
    >>
    >>Thank you.
    >>
    >>Does it work also for other browsers then IE?

    >
    > It works for me under FF and NS6.2.
     
    Csaba Gabor, Mar 31, 2005
    #6
  7. Bani

    McKirahan Guest

    "Csaba Gabor" <> wrote in message
    news:%FW2e.18135$...
    > Are you sure about that? onPaste has been logged as a Mozilla bug
    > at https://bugzilla.mozilla.org/show_bug.cgi?id=280683
    > (you can, however, mostly monitor a textbox/textarea for change in
    > FF though the buggy method at
    > https://bugzilla.mozilla.org/show_bug.cgi?id=285272)
    >
    > Also, I just tried the snippet below in my Firefox 1.0.1+ and got
    > no alert boxes vs both alert firing for IE 6 (on my Win XP Pro).
    >
    >
    > <body onpaste="alert('Body paste')">
    > <form name=mine method=get action=''>
    > <input name=tbtest onpaste="alert('Input paste')">
    > </form>
    > </body>
    >
    > Csaba Gabor from Vienna
    >
    > McKirahan wrote:
    > > "Bani" <> wrote in message
    > > news:...
    > >
    > >>I haven't seen this two event-handlers in my documentation. But it
    > >>works!
    > >>
    > >>Thank you.
    > >>
    > >>Does it work also for other browsers then IE?

    > >
    > > It works for me under FF and NS6.2.


    Here's what I used to test:

    <html>
    <head>
    <title>CopyPaste.htm</title>
    <script type="text/javascript">
    function myCopy() {
    alert("Copy");
    }
    function myPaste() {
    alert("Paste");
    }
    </script>
    </head>
    <body onCopy="myCopy()" onPaste="myPaste()">
    <form>
    <textarea cols="50" rows="10">Hello World</textarea>
    </form>
    </body>
    </html>
     
    McKirahan, Mar 31, 2005
    #7
  8. McKirahan wrote:

    > "Bani" <> wrote [...]:
    >> I haven't seen this two event-handlers in my documentation. But it
    >> works!
    >>
    >> Thank you.
    >>
    >> Does it work also for other browsers then IE?

    >
    > It works for me under FF and NS6.2.


    However, it is not Valid HTML and as such not supposed to work generally.
    Relying on it is risky at best.


    PointedEars┬░
    --
    Messen, was messbar ist, und messbar machen, was noch nicht messbar ist.
    -- Galileo Galilei
     
    Thomas 'PointedEars' Lahn, Apr 3, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bogosian
    Replies:
    5
    Views:
    4,813
    Jim Cheshire [MSFT]
    Jan 7, 2004
  2. Alex
    Replies:
    2
    Views:
    1,287
  3. Replies:
    26
    Views:
    2,175
    Roland Pibinger
    Sep 1, 2006
  4. Replies:
    1
    Views:
    333
  5. Mahsha
    Replies:
    2
    Views:
    2,290
    Gregor Kofler
    Jun 4, 2009
Loading...

Share This Page