var WsShell = new ActiveXObject('WScript.Shell') 
  WsShell.SendKeys('{F11}');
 
 网上这段代码能用在ie中,但是会有安全提示问题。这个有没有办法解决,或者尽量方便的解决这问题;
另外firefox里面这段代码不起作用,有什么办法实现f11功能

解决方案 »

  1.   

    <html>
    <body>
    <input   type= "text "   id= "txt "> </input>
    <script>
    window.onload=function(){
            var   txt=document.getElementById( "txt ");
            txt.onkeypress=function(evt){
                    evt=evt?evt:window.event;//根据不同浏览器取得按键事件产生的数据
                    evt.keyCode=49;//更改事件的keyCode,更改键盘输出,这样不管按下什么键都是输出1
            }
    }
    </script>
    </body>
    </html> 按键 F11的keycode是 122