若想实现如下图所示的操作:
代码干货,仅供大家参考!
样式代码:
<script type="text/javascript">
function buttonsub(buttonid){
if(buttonid=='sub1'){
document.form1.action='/ApproAwardYesServlet';
document.form1.submit();
}
if(buttonid=='sub2'){
document.form1.action='/ApproAwardNoServlet';
document.form1.submit();
}
if(buttonid=='sub3'){
document.form1.action='/AwardRelayServlet';
document.form1.submit();
}
}
</script>
jsp页面中使用该项功能的代码
<form name="form1" action="" method="post">
<table>
<tr>
<td>操作:</td>
<td>
<input name="Submit" id="sub1" onclick="buttonsub(this.id)"value="同 意">
<input name="Disagree"id="sub2"onclick="buttonsub(this.id)"value="拒 绝">
<input name="relay"id="sub3"onclick="buttonsub(this.id)"value="转 发">
</td>
</tr>
</table>
</form>