?
Solved

disable ability to highlight text in ie

Posted on 2001-06-04
9
Medium Priority
?
265 Views
Last Modified: 2008-03-06
Hi,

Does anyone know if there is a way to disable the user from highlighting text while using an instance of the ie?

Thanks ,
Chris
0
Comment
Question by:chrisshebib
  • 6
  • 3
9 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 6156364
<SCRIPT LANGUAGE="JavaScript1.2"><!--
function disableSelect() {
   if (navigator.appName=="Netscape")
        window.find(' ');
   else if (navigator.appName == "Microsoft Internet Explorer")
        document.selection.empty();
   else
       return true;   // do something else if you want
    return false;
}

document.onMouseDown = disableSelect;
//--></SCRIPT>

HTH,
CJ
0
 

Author Comment

by:chrisshebib
ID: 6156892
CJ,

I tried this but it had no effect - I'm using IE 5.5 with SP1.

Here is the code that I'm testing with:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
function disableSelect()
{  
     if (navigator.appName=="Netscape")      
     {
          window.find(' ');  
     }
     else if (navigator.appName == "Microsoft Internet Explorer")      
     {
          alert("MSIE");
          document.selection.empty();  
     }
     else      
     {
          return true;
     }
       
     // do something else if you want  
     return false;
}

document.onMouseDown = disableSelect;
//-->
</SCRIPT>

<body onload="disableSelect();">

<p>Here is some sample text</p>

</body>

</html>


Thanks,

Chris
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6157119
The code is supposed to work for NS4 and IE4.. I am not sure about IE 5.5
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:chrisshebib
ID: 6157232
Ok, thanks for you help anyway.

Chris
0
 

Author Comment

by:chrisshebib
ID: 6157306
Ok, thanks for you help anyway.

Chris
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 150 total points
ID: 6157419
0
 

Author Comment

by:chrisshebib
ID: 6157500
Ah, that did the trick.
 
Thanks very much.

Chris
0
 

Author Comment

by:chrisshebib
ID: 6157570
Ah, that did the trick.
 
Thanks very much.

Chris
0
 

Author Comment

by:chrisshebib
ID: 6157572
That did the trick!

Thanks very much,
Chris
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question