js动态更改Form表单action,进行提交

来源:互联网 发布:工业控制软件界面 编辑:程序博客网 时间:2024/05/21 12:45

**********************************step1******************************************

<form id="sys_indexMer_form"  class="form-search" action="<%=path %>/mer/exportExcel!exportCsv1.action" method="post">
<table class="table table-bordered">
<tbody>
<tr>
<td>商户名称:<input class="input-medium search-query" type="text" id="merchName" name="merchName" value="" /></ td>
<td>法人姓名:<input class="input-medium search-query" type="text" id="lawyerName" name="lawyerName" value="" /></td>
</tr>
<tr><td colspan="2">
<button type="button" class="btn btn-default" onclick="searchFun()">查找</button>
<button type="button" class="btn btn-default" onclick="cleanFun()">清空</button>
<button type="button" id="exportXLS" class="btn btn-info" onclick="ExportXLS()">导出EXCEL</button>
<button type="button" id="exportXLSInfo" class="btn btn-info" onclick="ExportXLSInfo()">导出EXCEL1</button>
</td>
</tr>
</tbody>
</table>
</form>



***************************************************step2***************************************

//导出excel
    function ExportXLS(){
$("#sys_indexMer_form").submit();
        }
    function ExportXLSInfo(){

var targetForm=document.forms[0]; 
//动态修改目标表单的action属性 
targetForm.action = "<%=path %>/mer/exportExcel!exportCsv.action";
//targetForm.method='POST';
//提交表单 
targetForm.submit();

    }

0 0
原创粉丝点击