通过button的reset属性,可以改变form.action的提交链接
<#if "${(supplyDetail.state)}" == "1">
<form action="${contextPath}/supplier/update.html" method="post" id="testForm" class="form-horizontal">
<#else>
<form action="${contextPath}/supplier/refuse/${supplyDetail.id}.html" method="post" id="testForm" class="form-horizontal">
</#if>
<div class="form-actions" align="center">
<#if "${(supplyDetail.state)}" == "1"><button type="submit" class="btn btn-primary" > 保存 </button>
<button type="reset" class="btn" οnclick="history.go(-1)">返回</button>
<#else>
<button type="reset" class="btn btn-primary" οnclick="testupdate()">同意 </button>
<button type="submit" class="btn btn-danger" > 驳回 </button>
<button type="reset" class="btn" οnclick="history.go(-1)"> 返回 </button>
</#if>
</div>
</form>
<script type="text/javascript">
function test() {
<!--//form.action = "${contextPath}/supplier/refuse/${supplyDetail.id}.html";-->
document.getElementById("testForm").action="${contextPath}/supplier/refuse/${supplyDetail.id}.html";
document.getElementById("testForm").submit();
<!--form.submit();-->
}
</script>
<script type="text/javascript">
function testupdate() {
<!--//form.action = "${contextPath}/supplier/refuse/${supplyDetail.id}.html";-->
document.getElementById("testForm").action="${contextPath}/supplier/update.html";
document.getElementById("testForm").submit();
<!--form.submit();-->
}
</script>