Disable right click and high lighting 1.0

MobileHacks

New Member
Disable right click and high lighting 1.0

Description:
Disable right click and high lighting.

Installation:
Do the template edits.

Template Edits:

In headinclude template, add this at the top:


PHP:
<script language="JavaScript1.2">
var message="Text Here";
function click(e)
{
  if (document.all)
  {
    if (event.button==2||event.button==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    if (e.button==2||e.button==4)
    {
      e.preventDefault();
      e.stopPropagation();
      alert(message);
      return false;
    }
  }

}

if (document.all) // for IE
{
  document.onmousedown=click;
}
else // for FF
{
  document.onclick=click;
}
</script>
<script type="text/javascript">
function ehan( evnt )
{
  if( evnt.which == 3 )
  {
    alert( "Text Here" );
    return false;
  }
  return true;
}
function ocmh()
{
  alert( "Text Here" );
  return false;
}
document.oncontextmenu = ocmh;
document.captureEvents( Event.MOUSEDOWN );
if( document.layers ) document.onmousedown = ehan;
</script>

<SCRIPT language="JavaScript">
if (window!=top){top.location.href=location.href;}
</script>
<script type="text/javascript">
<!--
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
-->
</script>

    
    <SCRIPT language="JavaScript">
if (window!=top){top.location.href=location.href;}
</script>
<script type="text/javascript">
<!--
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
-->
</script>


History:
1.0 10-08-08
First Release
 
Back
Top