-
help: script for limit the text selection
I need this thing plz whrer i can find it
this script can limit the text selection, for examle, if the visitor select all text, then he cannot select all text but he can select only specific number of words or characters such as 20 words only or 200 charaters only.
so, I dont need script which prevent the select totaly.
thank you.
-
-
Here: I don't know where it is, but I know how to do it. After the text is selected, make it a string var. Check its length by using .length. If it doesn't fit your needs, the user isn't allowed to select the text.
-magicyte
-
-
thank you magicyte, but I am poor in programming, I have the code of the script which prvent the selection, can you edit this to select only 20 character :
this code :
<script type="text/javascript">
/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
target.style.MozUserSelect="none"
else //All other route (ie: Opera)
target.onmousedown=function(){return false}
target.style.cursor = "default"
}
//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
</script>
<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page
</script>
thank you.
-
-
Plz , any one here can help me
-
-
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks