Cognos总结五(JavaScript)

1、屏蔽IE8浏览器点击折线出现热点问题
<script>
var areaObjs = document.getElementsByTagName('area');
for(var i = 0; i < areaObjs.length; i++){
       var el = areaObjs[i];
       if(el.attachEvent){ 
       el.attachEvent('onfocus', function(){
    el.blur();
           }); 
       }
}
</script>
2、Cognos报表屏蔽报表右键功能
<SCRIPT type="text/javascript">

  if(window.oCV_NS_)
   {
    window.oCV_NS_.bCanUseCognosViewerContextMenu = false;
    window.oCV_NS_.bCanUseCognosViewerSelection = false;
   }  
   if(window.oCVRS)
   {
    window.oCVRS.bCanUseCognosViewerContextMenu=false;
    window.oCVRS.bCanUseCognosViewerSelection = false;
   }

function shield_rightclk()
{
   if(window.oCV_NS_)
   {
    window.oCV_NS_.bCanUseCognosViewerContextMenu = false;
    window.oCV_NS_.bCanUseCognosViewerSelection = false;
   }  
   if(window.oCVRS)
   {
    window.oCVRS.bCanUseCognosViewerContextMenu=false;
    window.oCVRS.bCanUseCognosViewerSelection = false;
   }

}

function block(oEvent)
{
  shield_rightclk();
  if(window.event)
  {
   oEvent=window.event;
   oEvent.returnValue=false;  
  }
  else

   oEvent.preventDefault();
  }
}
document.oncontextmenu=block;

</SCRIPT>

你可能感兴趣的:(JavaScript,浏览器)