<form name=form1>
<input name=btm1 type=button onclick=alert("a1")>
<input name=btm2 type=button onclick=alert("a2")>
<input name=btm3 type=button onclick=alert("a3")>
</form><script>
function document.onkeydown(){
with(window.event)
try{document.form1("btm"+String.fromCharCode(keyCode)).click()}catch(e){}
}
</script>

解决方案 »

  1.   

    window 的快捷键定义是Alt+ X如:<form name=form1>
    <input name=btm1 type=button onclick=alert("a1") accessKey=1>
    <input name=btm2 type=button onclick=alert("a2") accessKey=2>
    <input name=btm3 type=button onclick=alert("a3") accessKey=3>
    </form>
      

  2.   

    <form name=form1>
    <input name=btm1 type=button onclick=alert("a1")>
    <input name=btm2 type=button onclick=alert("a2")>
    <input name=btm3 type=button onclick=alert("a3")>
    </form>忘了加ctrlKey了
     
     <script>
    function document.onkeydown(){
    with(window.event)
    if(ctrlKey)try{document.form1("btm"+String.fromCharCode(keyCode)).click()}catch(e){}
    }
    </script>
      

  3.   

    请问秋水:
     catch(e)是什么意思?
    另String.fromCharCode(keyCode)).函数的意思呀,
    我有想是
    一个界面里有很我按钮,
    比如我按ctrl+g就按执行a1()
    按ctrl+ ->就执行a2()
    只按 ->就执行a3()
    你可不可以给我个例子呀
      

  4.   

    sym1978(爱新) 
    强烈建议你看些书,几乎每本书都会提到异常处理。书中有最好的解释!祝你好运