你没有在 keyDown 事件里给 xm 的值加上 keyCode 呀。

解决方案 »

  1.   

    不好意思,代码贴错了,但是加上以后还是取不出来
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body><script language="javascript">
      function aa(key)
       {
        if(event.keyCode==13)
         {
           form1.submit();
         }
       }
    </script><form name="form1" action="action.jsp" method="post">
      <input type="text" name="xm" onkeyDown="aa(event.keyCode)">
    </form>
    </body>
    </html>
      

  2.   

    你在action.jsp里是怎么取的啊?
      

  3.   

    估计是在action.jsp中提取出错了
      

  4.   

    action.jsp中是这样取的!<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <title>无标题文档</title>
    </head><body>
      <%
        String name = request.getParameter("xm");
        out.println(name);
      %>
    </body>
    </html>