Hi,
I have a text box and should allow user to type the text but not to allow them to copy/paste or right click.
Here is the code.
It works properly in IE and in mozilla also but in mozilla when right click option is used it will display the message saying that "Not allow right click option" but the menu will also displayed (i.e cut,copy,select all) and it allows to paste also.
How can this be avoided?
Any suggestions!!
with regards
Archana
I have a text box and should allow user to type the text but not to allow them to copy/paste or right click.
Here is the code.
Code:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script language="javascript"> function whichButton(event) { if (event.button==2)//RIGHT CLICK { alert("Not Allow Right Click!"); } } function noCTRL(e) { var code = (document.all) ? event.keyCode:e.which; var msg = "Sorry, this functionality is disabled."; if (parseInt(code)==17) //CTRL { alert(msg); window.event.returnValue = false; } } </script> </head> <body> <form method=""> <strong>Not Allow Paste </strong><BR> <input type="text" value="" onMouseDown="whichButton(event)" onKeyDown="return noCTRL(event)"/> </form> </body> </html>
How can this be avoided?
Any suggestions!!
with regards
Archana
Comment