您的位置:首页 > 其它

一个Form表单处理提交多个submit按钮

2014-06-26 14:43 716 查看
例:

1.实现效果



2.页面部分代码

<script type="text/javascript">

    function tongguoAll(){

      document.myform.action="/test/servlet/TongguoServlet?method=allY";
      document.myform.submit();

   }

   function tongguoNone(){

      document.myform.action="/test/servlet/TongguoServlet?method=allN";
      document.myform.submit();

   }

    </script>

<form name="myform" method="post">

<table width="900" border="1" align="center" bgcolor="#eeeeee" 

cellpadding="1" cellspacing="0" bordercolor="#bbbbbb" style="font-size: 12px; text-align: center;">

    <tr>

    <td colspan="6" align="right"> 

       <input type="submit" value="全部通过" onclick="tongguoAll()" />

      <input type="submit" value="全部不通过" onclick="tongguoNone()"/>

</tr>

</table>    

       <input type="submit" name="submit_name" value="全部通过"  />
       <input type="submit"

name="submit_name" value="全部不通过" />

第二种方法是在服务器端判断submit按钮的value值

request.getParameter("submit_name").equals("全部通过")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: