怎么没人会啊?经过我测试,如果去掉 editor.document.designMode="on" 则可以正 alert ,关键是我必须要 document.designMode = "on"请高手赐教。 

解决方案 »

  1.   

    你开什么玩笑,就  editor 直接写嘛也不得行嘛
      

  2.   


    <script language="javascript">
    function showContextMenu()
    {
        alert("Show it!");
        return false;
    }function a(){
       var editor = window.frames["editor"];
       editor.document.designMode="on"
       editor.focus();
       editor.document.contentEditable = true; 
       
       if(document.all){
       editor.document.oncontextmenu = new Function("return showContextMenu();")
       }else{
       editor.document.addEventListener("contextmenu", function(oEvent){ oEvent.preventDefault(); return showContextMenu();}, false);
       }
    }
    </script>