Programming C# C++ (7) Delphi (618) Java (8) JavaScript (30) Document (8) Events (8) ExtJS (8) Strings (3) perl (9) php (4) VBScript (1) Visual Basic (1)
Exchange Links About this site Links to us 
|
Disable text selection with the mouse
8 comments. Current rating: (3 votes). Leave comments and/ or rate it.
Question: How can I disable text selection by mouse clicking or dragging of a text block?
Answer: You could disable any mouse-down event with code as shown below (to be put in an onload event. The downside of this is that nothing will work anymore, not even clicks on links.
Also know that a user still can click on the document and use 'Select All' from the Edit menu (or in Internet Explorer even use a shortcut Control+A), followed by 'Copy' from the menu.
There is simply no way to protect displayed content, you can only make it a bit more difficult.
 | |  | |
if (document.all)
document.onselectstart =
function () { return false; };
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown =
function (evt) { return false; };
}
document.onmousedown = function () { return false; };
| |  | |  |
Comments:
|
|
|
|
thanks
|
|
|
|
|
how do i turn it back on?
|
|
|
|
|
koszi
|
|
|
|
|
You spelled harare wrong. Harare is how you spell it :)
|
2008-04-12, 08:45:30 (updated: 2008-04-12, 08:48:41) |
|
|
Check out the tool at http://www.enc.rypt..select.php also. It is an alternative method to using Javascript to disable selecting text on a web page.
The tool there inserts invisible characters into text which make it near impossible to copy and paste text.
Javascript can easily be turned off on the browser, rendering any Javascript disabled.
|
|
|
|
|
|
|
|
|
|
I added a photo of someone that I was trying to find out if he is a SCAMER or not . Do you post them for all to see ? Or only use it as a TEST PHOTO ? That is how I sent it I guess I am not sure how this site works, So if you would please let me know how to work it , I really need to know about this person as I may have been a SUCKER for to long! Light Roves is the name he is from Ghana Africa As I see many Woman from Ghana that have SCAMED many men and it is wrong as this may be the case for me with this man I am not sure any Truth would be of great help! Thanks 'Miss Don't want to be WRONG'
|
2008-10-05, 08:35:01 (updated: 2008-10-05, 08:35:56) |
|
|
|
Listen sweetheart you should post the email letters and all the pics you have of this guy 90% sure this guy is a scam if you want help you can get it from this site. people will help here jake
|
|