<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 11pt;
font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">


</script></head><body style="background-image:url(images/admin_login_bg1.png); margin:0 auto; width:500px;"><div style="background-image:url(images/admin_login1.png); width:500px; height:200px; margin-top:130px;">
  <form id="form1" name="form1" method="post" action="123.html">
    <table width="500" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="250">&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td height="40"><div align="right" class="STYLE1">用户名:</div></td>
        <td height="40" colspan="2"><input type="text" name="user.username" style="height:25px; width:200px; font-size:15pt; font-weight:bold;" /></td>
      </tr>
      <tr>
        <td height="40"><div align="right" class="STYLE1">密&nbsp; 码:</div></td>
        <td height="40" colspan="2"><input type="password" name="user.password" style="height:25px; width:200px; font-size:15pt; font-weight:bold;" /></td>
      </tr>
      <tr>
        <td height="40"><div align="right" class="STYLE1"><input type="radio" value="0" name="user" checked="checked">员工</div></td>
        <td width="100" height="40">&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="1" name="user">管理员</td>
      </tr>
      <tr>
        <td height="40">&nbsp;</td>

        <td height="40" colspan="2"><a href="#"><img src="images/admin_login_button.png"></a></td>
      </tr>
    </table>
  </form>
</div></body>
</html>我这里有两个单选按钮,一个是普通用户,一个是管理员,要做的就是当我选择了员工这个按钮,登录就进去就到员工页面,同理管理员也是一样!现在的问题就是怎么做当我选择员工时,<form action="">action能够指向就是员工的action,选择管理员按钮时,action指向就是管理员action   !!!!

解决方案 »

  1.   


    <img src="images/admin_login_button.png" onclick="sub();">
    <script>
    function sub(){
    if(document.form1.user[0].checked){
    document.form1.action="staffActionName.action"
    }else{
    document.form1.action="managerActionName.action"
    }
    document.form1.submit();
    }
    </script>
      

  2.   

    同一个action处理不同的逻辑也可以!何必换两个action
      

  3.   

    把单选按钮给一个id名和不同的值 比如说1和0  表单提交之后  在action里面取出值判断一下就行了  1就跳用户页面 0就跳管理员页面