473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 4925
Something like this:

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

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

"RelaxoRy" <re******@postmaster.co.uk> wrote in message
news:3b**************************@posting.google.c om...
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******@postmaster.co.uk> wrote in message
news:3b**************************@posting.google.c om...
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? :)


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******@postmaster.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******@postmaster.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 "ondragstart" 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
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...
0
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...
7
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
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...
4
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...
2
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...
3
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...
14
by: > Adrian | last post by:
Is there a way of stopping text from highlighting in textbox? Many thanks, Adrian.
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...

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.