如题,请多指教!

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <script type="text/javascript">
      <!--
    function showMsg(){
    var code = event.keyCode;
    if(code == 13){
    alert('你按了回车键!');
    }

    }
      //-->
      </script>
     </head> <body>
    回车:<input onkeyup="showMsg()">
     </body>
    </html>
      

  2.   

    <input  ...  />里面可以用JSP的函数来确定你要出发的事件!
      

  3.   


    上边打错了,是script函数!
      

  4.   

    在input 里面加上 onkeyup=" if(event.keyCode==13) { 要触发的事件JS }"就行了
      

  5.   

    window.document.onkeydown = showMsg;function showMsg() {
        var keycode = event.keyCode;
        
        if (keycode == 13) {
            if(window.event.srcElement.tagName == "INPUT"){
                if(window.event.srcElement.type == "text" ||
                    window.event.srcElement.type == "password" ||
                    window.event.srcElement.type == "file"){
       alert('你按了回车键!');
                       return false;
                }
            }
         }
    }