473,616 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stopping mouse selecting text

Is there any way to stop someone getting their mouse and selecting
text on a page (without making the text an image of course). Is it
possible to trap and stop click-and-drag functionality from the mouse?

Bit of a stranger request but can it be done? :)

Cheers
Ryan
Jul 20 '05 #1
4 4956
Something like this:

<script type="text/javascript">
mClicked=false
</script>

<body onmousedown="mC licked=true" onmuseup="mClic ked=false" onmousemove="if
(mClicked) alert('Disabled '); mClicked=false" >

"RelaxoRy" <re******@postm aster.co.uk> wrote in message
news:3b******** *************** ***@posting.goo gle.com...
Is there any way to stop someone getting their mouse and selecting
text on a page (without making the text an image of course). Is it
possible to trap and stop click-and-drag functionality from the mouse?

Bit of a stranger request but can it be done? :)

Cheers
Ryan

Jul 20 '05 #2
"RelaxoRy" <re******@postm aster.co.uk> wrote in message
news:3b******** *************** ***@posting.goo gle.com...
Is there any way to stop someone getting their mouse and
selecting text on a page (without making the text an image
of course). Is it possible to trap and stop click-and-drag
functionalit y from the mouse? Bit of a stranger request but can it be done? :)


Yes and No. IE browsers have events like onselectstart and ondragstart
that can be cancelled, effectively inhibiting the selection of content.
Opera, on the other hand, has no mechanism for doing anything of the
sort.

You will have to explain why you want to prevent text selection because
you are probably attempting to solve the wrong problem and explaining
what the real problem is would enable people to suggest ways of solving
it.

Richard.

Jul 20 '05 #3
Vjekoslav Begovic wrote:
"RelaxoRy" <re******@postm aster.co.uk> wrote
Is there any way to stop someone getting their mouse and selecting
text on a page

Something like this:


<snip> JS </script>

Of course, if the objective is to stop people copy/pasting the content, its
a fruitless endeavour. There is nothing to stop people from viewing the
source or turning JS off.

http://david.us-lot.org/www/hide/

--
David Dorward http://david.us-lot.org/
Which is stupider: Pop-up ads claiming they'll stop spam, or spam claiming
it'll stop pop-up ads? -- Dork Tower
Jul 20 '05 #4
re******@postma ster.co.uk (RelaxoRy) writes:
Is there any way to stop someone getting their mouse and selecting
text on a page (without making the text an image of course). Is it
possible to trap and stop click-and-drag functionality from the mouse?
Generally, no.

Some browsers has event handlers like "ondragstar t" which can be
canceled. Others don't. In all cases, turning off Javascript will
stop that attempt.
Bit of a stranger request but can it be done? :)


IN some situations, yes. In general, no.
In general, you shouldn't want to interfere with the users' way
of using a browser.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
377
by: Nick Stubbs | last post by:
Can anyone tell me how to code the listbox so I can move an item up and down the listbox with the mouse. For example, the play list in Winamp 5 can be sorted by you selecting a song and moving it up or down the play list by selecting it with the mouse and dragging it where you want. The list box gets the contents from a .txt file. (if you need more info please let me know) Many Thanks Nick
0
1301
by: Cathy | last post by:
Hi, Has anyone else experienced this problem while working in the VB.Net code behind: when selecting text with the mouse, the text does not stay selected but instead the selection jumps to the previous line of code and selects that text; or when selecting part of the text on a line the selection jumps tot he text on the same line that was not selected.
7
1875
by: Adriano | last post by:
hello, is there any code to catch mouse move? I mean to catch X and Y locations on a form? tnx in advance, Adriano
25
2668
by: Romanise | last post by:
An LCD monitor with keyboard and mouse capabilities on it, thinnest possible, to hang on rack-door can be a boon for expensive spaces of datawarehouses. Has anyone come across one? Maybe someone would go into manufacturing it. £800 Dell product I am told occupies equivalent of two server space in a rack.
4
1833
by: Nick Wedd | last post by:
I have a test page http://www.files.maproom.org/00/12/q/w.html which almost does what I want. The idea is that, when you hover the mouse over one of the dates near the top of the page, it updates _both_ the appearance of the map, _and_ the text appearing in the iframes further down the page. I would like it to do this smoothly; but each time you select a new page, the browser window jerks down to the iframes (where the text was...
2
1371
by: UJ | last post by:
I've got a text box that I'm going to be doing some manipulation on (selecting text, moving stuff around, that kind of thing) but I don't want/need the user to see it while it's going on. I'd like to leave the box up while I'm doing the manipulation but turn off the updating of the text box until I'm done. How can I do this? (At the moment it flashes a couple of times while things are going on and it's annoying.) TIA - Jeff.
3
1931
by: Jon Delano | last post by:
Hi I was wondering if it were possible to somehow stop a page from posting back to the server and running the server side code. I have a datagrid and the first column is basically a button. I have added a javascript function to the button : Dim btnView As LinkButton = e.Item.Cells(0).Controls(0) btnView.Attributes.Add("onclick", "CheckDictationMode();")
14
13376
by: > Adrian | last post by:
Is there a way of stopping text from highlighting in textbox? Many thanks, Adrian.
2
3725
by: =?Utf-8?B?UmFqbmVlc2ggTmFyYWlu?= | last post by:
Hi, I have a ComboBox in a Windows app (.net2.0). And when users start typing into it, the dropdown populates itself from a webservice and gives relevant options under it... But the mouse hides itself, os its very hard to know what you are selecting. The reason for mouse hiding itself is because in Control Panel >Mouse >> Pointer Options >Hide pointer while typing is checked.
0
8647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8592
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8297
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7121
agi2029
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...
1
6097
isladogs
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...
0
5550
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();...
0
4141
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2579
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.