disable ability to highlight text in ie

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
chrisshebibAsked:
Who is Participating?
 
cheekycjCommented:
<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
 
chrisshebibAuthor Commented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
cheekycjCommented:
The code is supposed to work for NS4 and IE4.. I am not sure about IE 5.5
0
 
chrisshebibAuthor Commented:
Ok, thanks for you help anyway.

Chris
0
 
chrisshebibAuthor Commented:
Ok, thanks for you help anyway.

Chris
0
 
chrisshebibAuthor Commented:
Ah, that did the trick.
 
Thanks very much.

Chris
0
 
chrisshebibAuthor Commented:
Ah, that did the trick.
 
Thanks very much.

Chris
0
 
chrisshebibAuthor Commented:
That did the trick!

Thanks very much,
Chris
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.