Is this possible with Javascript in anyway? :) 13 31983
On Dec 2, 6:47 am, halbe...@gmail. com wrote:
Is this possible with Javascript in anyway? :)
Yes, it is possible to detect a paste action.
Here's a simple exemple, preventing to paste in a textarea :
<html>
<head>
<script>
window.addEvent Listener('load' , function (e)
{
document.getEle mentById('text' ).addEventListe ner('keydown', function
(e)
{
if (e.keyCode == 86) //86 is Paste event
{
alert('You may not paste here !');
e.preventDefaul t();
}
document.getEle mentById('event s').innerHTML += e.keyCode + ' ' +
e.which + '<br />';
}, false);
}, false);
</script>
</head>
<body>
<textarea id="text">
</textarea>
<div id="events">
</div>
</body>
</html> dr*********@gma il.com a écrit :
On Dec 2, 6:47 am, halbe...@gmail. com wrote:
>Is this possible with Javascript in anyway? :)
Yes, it is possible to detect a paste action.
Here's a simple exemple, preventing to paste in a textarea :
How do you expect to tape 'v' ? or 'V' ?
Anyway,
that doesn't work at all !
report under textbox tells me : 224 224
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
On Dec 2, 1:18 pm, ASM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
wrote:
dracogni...@gma il.com a écrit :
On Dec 2, 6:47 am, halbe...@gmail. com wrote:
Is this possible with Javascript in anyway? :)
Yes, it is possible to detect a paste action.
Here's a simple exemple, preventing to paste in a textarea :How do you expect to tape 'v' ? or 'V' ?
Anyway,
that doesn't work at all !
report under textbox tells me : 224 224
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Oups... You're totally rights... >_<
I'm sorry i wasn't careful enough about that...
I'm going to see if I can do something about it :p
P.S. Ton mac est si vieux ?
--
Naixn.
On Dec 2, 1:30 pm, "dracogni...@gm ail.com" <dracogni...@gm ail.com>
wrote:
On Dec 2, 1:18 pm, ASM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
wrote:
dracogni...@gma il.com a écrit :
On Dec 2, 6:47 am, halbe...@gmail. com wrote:
>Is this possible with Javascript in anyway? :)
Yes, it is possible to detect a paste action.
Here's a simple exemple, preventing to paste in a textarea :How do you expect to tape 'v' ? or 'V' ?
Anyway,
that doesn't work at all !
report under textbox tells me : 224 224
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of dateOups... You're totally rights... >_<
I'm sorry i wasn't careful enough about that...
I'm going to see if I can do something about it :p
P.S. Ton mac est si vieux ?
--
Naixn.
<script>
window.addEvent Listener('load' , function (e)
{
document.getEle mentById('text' ).addEventListe ner('keydown', function
(e)
{
if (e.keyCode == 86 && e.ctrlKey) //86 is 'v' char key
{
e.preventDefaul t();
}
document.getEle mentById('event s').innerHTML += e.keyCode + ' ' +
e.which + '<br />';
}, false);
}, false);
</script>
Here it is.
I forgot to put the "e.ctrlKey" check ( to check wether control key was
pressed, or not.
Thing is I don't have any way to try javascript on Safari ( as there's
no JavaScriptCore port on Linux, apart from KHTML, which begins to
differs a lot from WebCore... ).
What is 224 ? Ctrl+V keycode, or V keycode ?
Is the e.ctrlKey working with safari ? Since I know you have to "pomme
+ v" to paste ( sorry I don't remember the english equivalent for
'pomme' [ I just know it's not " Apple " :p ] ).
--
Naixn. dr*********@gma il.com a écrit :
On Dec 2, 1:18 pm, ASM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
wrote:
>that doesn't work at all !
Oups... You're totally rights... >_<
I'm going to see if I can do something about it :p
P.S. Ton mac est si vieux ?
The so noisy G4 MDD (1,25Mhz OS 10.3.9) 2 years old.
P.S. : qu'est-ce qu'il a le Messenger de ton Mozilla ?
(pour ne pas gommer la signature de l'envoyeur dans les réponses)
--
Stephane Moriaux et son moins vieux Mac déjà dépassé
Stephane Moriaux and his less old Mac already out of date
ASM wrote :
dr*********@gma il.com a écrit :
>On Dec 2, 1:18 pm, ASM <stephanemoriau x.NoAd...@wanad oo.fr.invalid> wrote:
>>that doesn't work at all !
>Oups... You're totally rights... >_< I'm going to see if I can do something about it :p
>P.S. Ton mac est si vieux ?
The so noisy G4 MDD (1,25Mhz OS 10.3.9) 2 years old.
P.S. : qu'est-ce qu'il a le Messenger de ton Mozilla ?
(pour ne pas gommer la signature de l'envoyeur dans les réponses)
In fact, it's an old one!
Please refer to my previous post to check the changes I made.
Maybe you'll also be able to answer my safari-specific questions :)
P.S. : Tout simplement que j'utilisais google newsgroups.
C'est maintenant corrigé :)
--
Naixn http://fma-fr.net dr*********@gma il.com a écrit :
>
Here it is.
I forgot to put the "e.ctrlKey" check ( to check wether control key was
pressed, or not.
On Mac Control key is not used to copy/paste/etc
we use touch Command (Pomme).
With FireFox, with Command + v and Command + z
keyCode returns 224
Command associated with others touchs (x, a, p, ... ) keyCode returns
correspondant character/touch key code.
Thing is I don't have any way to try javascript on Safari
My tests show Safari doesn't report touch Command (Pomme - Apple)
nor keyCode as if anything was pressed.
My test with Opera : Opera doesn't give a special code for
Command+v Command+c (normal letter key code)
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
ASM wrote :
dr*********@gma il.com a écrit :
>> Here it is. I forgot to put the "e.ctrlKey" check ( to check wether control key was pressed, or not.
On Mac Control key is not used to copy/paste/etc
we use touch Command (Pomme).
With FireFox, with Command + v and Command + z
keyCode returns 224
Command associated with others touchs (x, a, p, ... ) keyCode returns
correspondant character/touch key code.
>Thing is I don't have any way to try javascript on Safari
My tests show Safari doesn't report touch Command (Pomme - Apple)
nor keyCode as if anything was pressed.
My test with Opera : Opera doesn't give a special code for
Command+v Command+c (normal letter key code)
Well, let's correct it :
<script>
window.addEvent Listener('load' , function (e)
{
document.getEle mentById('text' ).addEventListe ner('keydown', function
(e)
{
if ((e.keyCode == 86 && e.ctrlKey) || (e.keyCode == 224 && e.metaKey)
{
e.preventDefaul t();
}
document.getEle mentById('event s').innerHTML += e.keyCode + ' ' +
e.which + '<br />';
}, false);
}, false);
</script>
Ok now, how does it work with you, with this correction ? :)
--
Naixn http://fma-fr.net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ringwraith |
last post by:
Hello!
How to detect in Python that some click action was performed in some module
imported by my main module?
Let's assume I have a tree.py module that implements all functionality of a
tree view widget and my sample application (let's say myapp.py) that imports
those tree module to create tree view control inside the main frame. I want
in my application to have some method that responds immediately (!!!!) to
click action performed...
|
by: Radovan Radic |
last post by:
Hello all,
I am new to .NET and a i am moving from Delphi (finally!) to C#.
Now, i am trying to develop custom TextBox for numeric input. I have done it
almost, now i need to prevent paste so someone couldnt paste letters into
numeric text box. How this can be done in C#? In Delphi there was method to
implement methods wiht message code WM_PASTE, and within that method i could
control the contents of the pasted text.
Thanks.
|
by: Andrés OrtÃz |
last post by:
Hi
I need that my TextBox don't work for copy-paste (Ctrl+C) and other forms
that we used for copy text.
Thanks
|
by: Steve |
last post by:
Hi all,
Is it possible to disable pasting from the clipboard into a textbox ?? I
can't find a property for it but I guess it must be possible.
thanks
Steve
|
by: Rich |
last post by:
Hello,
I need to trap/detect when a textbox is entered via the tabkey. If the
textbox is not empty when entered via the tabkey then set focus to next
textbox. To enter that textbox would then require a mouseclick if it already
contains text to be edited. I am guessing that I would need to trap for
this in the Enter Event of this particular textbox.
I tried this in the Enter Event of the Textbox, but...
| |
by: Julian |
last post by:
Hi
In VB .Net how do you prevent characters apart from numbers being pasted
into a text box?
Julian
|
by: Dan Sikorsky |
last post by:
How can we tell if the value in a FormView EditItemTemplate TextBox has
changed from its initial value so that we know if we have to update the
corresponding db table column value?
--
Thank you kindly,
Dan Sikorsky BA, BSCE, MCS
|
by: Steve |
last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user
clicks on a toolbar button, the cut/copy/paste will work with whatever
textbox the cursor is current located in (I have about 20 textboxes on the
form). Also to ensure that the button can't get used if the cursor isn't in
a textbox field. And to ensure the contents of the clipboard are "text"
contents that have been cut/copied from one of the textboxes on the form.
...
|
by: sid |
last post by:
Can someone tell me how to detect "Action Cancelled" page with out
polling.
I have a frame set and I want to make sure the other frame is
displaying what it is supposed to without polling. For some reason
the page does not file OnError or OnLoad events.
Any help is appreciated.
Thanks
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |