这是我的代码,但是不跳转,各位帮忙看看
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'reg.jsp' starting page</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->  </head>
  
  <body>
  <center>
  用户注册<br>
  <hr>
    <form action="" method="post" onsubmit="direction(this);">
  请选择用户类型:
  <input type="radio" value="1"  name="redio1" checked>普通用户
  <input type="radio" value="2" name="redio2">管理员
  <hr>
  请输入用户名:<input type="text" name="username">
 <input type="submit" value="下一步">
 </form>
 <script type="text/javascript">
  function direction(myform){ 
if(myform.number[1].checked){ 
form.action="regUser.jsp"; 

if(myform.number[2].checked){ 
form.action=""; 

   }
 </script>
  </center>   
  </body>
</html>

解决方案 »

  1.   

    onsubmit="return direction(this)"
      

  2.   

    还是没有任何反应,能根据下面的代码,帮我写个跳转吗,普通用户跳转到regUser.jsp  管理员跳转到regAdmin.jsp
    <form action="" method="post" onsubmit="direction(this);">
      请选择用户类型:
      <input type="radio" value="1" name="redio1" checked>普通用户
      <input type="radio" value="2" name="redio2">管理员
      <hr>
      请输入用户名:<input type="text" name="username">
     <input type="submit" value="下一步">