//防拷贝
function loadPageIsCopyAndDown()

var isCopy = document.getElementById("isCopy").value;
if(isCopy == 1)
{
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
}
}
上面的代码是实现禁用右键及选择,只能在 IE 里运行,现在我要既能在 IE 里运行,又能在 Firefox 里运行,该怎么写?非常感谢!!

解决方案 »

  1.   

    火狐好像是 event.preventDefault();
      

  2.   


    thisURL = (document.URL).toLowerCase( );
    iArr=1;
    for(i=0;i<10;i++){
      if(thisURL.indexOf("index"+i)>0){
        while (document.getElementById("index"+iArr)){
           document.getElementById("index"+iArr).className="";
       iArr++;
        }
    document.getElementById("index"+i).className="now";
    break;
      }
    }
      

  3.   

    <body oncontextmenu="return false;">
    这样行不?
      

  4.   

    <body oncontextmenu="return false" onselectstart="return false">
    <noscript><iframe src=*.html></iframe></noscript>
    <script>
    function stop(){
    return false;
    }
    document.oncontextmenu=stop;
    </script> 
      

  5.   

    <style type="text/css">
    body 

    -moz-user-focus: ignore; 
    -moz-user-input: disabled; 
    -moz-user-select: none; 
    }
    </style>   <script type='text/javascript'>
           window.document.oncontextmenu = function() { return false; }       window.document.onselectstart = function() { return false; }
        </script>
      

  6.   

    我要这样的效果:
    //防拷贝
    function loadPageIsCopyAndDown()
    {  
    var isCopy = document.getElementById("isCopy").value;
    if(isCopy == 1)
    {
    if(IE explorer)
    {
    document.oncontextmenu=new Function("event.returnValue=false");
    document.onselectstart=new Function("event.returnValue=false");
    }
    else
    {
    firofox 里就不会写了 
    }

    }