在body上加一个 onkeypress事件
然后利用事件的ctrlKey 和f2的键值判断
doument.all.links[0].focus();

解决方案 »

  1.   

    <html> <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <title>快捷键,设置控件焦点</title> 
    <script> 
    var ctrl=false; 
    var F2=false; window.onblur=function(){ 
    ctrl=false; 
    F2=false; } 
    document.onkeydown=function(){ 
    if(event.keyCode==17){ 
    ctrl=true; 
    }else if(event.keyCode==113){ 
    F2=true; 
    }
    if(ctrl&&F2){ document.getElementById("getfs").focus();} } 
    document.onkeyup=function(){ 
    if(event.keyCode==17){ 
    ctrl=false; 
    }else if(event.keyCode==113){ 
    F2=false; 
    }

    </script> 
    </head> <body> 
    <input name="getfs" id="getfs" >
    </body> </html>
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>
    <script type="text/javascript">
    var preKey = null;
    function getKeyDown(evnt)
    {
    var oEvnt = evnt? evnt:window.event; if( (preKey == 113 && oEvnt.ctrlKey)  || (preKey == 17 && oEvnt.keyCode == 113) )
    document.links[0].focus();

    preKey = oEvnt.keyCode;
    }function cleanPreKey()
    {
        preKey = null;
    }document.onkeydown = getKeyDown;
    document.onkeyup = cleanPreKey;
    </script>
    </head>
    <body>
    <a href="1.html">1HTML</a>
    <a href="2.html">2HTML</a>
    <a href="3.html">3HTML</a>
    <a href="4.html">4HTML</a>
    <a href="5.html">5HTML</a>
    </body></html>