By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,624 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,624 IT Pros & Developers. It's quick & easy.

Access browser menu (copy/paste) from Javascript

P: n/a
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.

Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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
Jul 23 '05 #2

P: n/a
"Bani" <ur*************@gmx.ch> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
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?
Jul 23 '05 #3

P: n/a
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?

Jul 23 '05 #4

P: n/a
"Bani" <ur*************@gmx.ch> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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.
Jul 23 '05 #5

P: n/a
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" <ur*************@gmx.ch> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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.

Jul 23 '05 #6

P: n/a
"Csaba Gabor" <cs***@z6.com> wrote in message
news:%F*******************@news.chello.at...
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" <ur*************@gmx.ch> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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>
Jul 23 '05 #7

P: n/a
McKirahan wrote:
"Bani" <ur*************@gmx.ch> 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
Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.