在一个form表单中根据不同按钮实现多个action事件

<pre name="code" class="plain"><form id="centerMonthReport" action="${ctx}/exportMonth/oneReport" method="POST">
	<table>
		<tr>
			<td><label>${i18N_sdsTime}</label></td>
			<td><jvform:Monthfield id="date" value="${date}" title=""></jvform:Monthfield></td>
			<td>${i18N_exportType}</td>
			<td><jvform:select id="monthType" title="" optionsType="2" options="${typeList}"></jvform:select></td>
			<td>文件类型</td>
			<td><jvform:select id="fileType" title="" optionsType="2" options="${fileTypeList}"></jvform:select></td>
			<td>
				<div class="control-group">
				<div class="controls">
				<input type="button" value="${i18N_exportMonthReport}" class="btn-success" οnclick="submitform2()">
			<span style="white-space:pre">	</span></div>
			</div>
		</td>
	</tr>
</table>
</form>
function submitform2() {
		var cen = $("#monthType").val();
		if (cen == null || cen == '') {

			alert("请选择要导出月报的类型");
		} else {
			var filetype = $("#fileType").val();
			if(filetype == null || filetype == ""){
				alert("请选择要导出的文件类型");
			}else{
				if("pdf"==filetype){
					$("#centerMonthReport").attr("action","${ctx}/exportMonth/oneReport").submit();
<span style="white-space:pre">					</span>//这里若不重新设置action,在执行下面的action后,action就会是下面的action
				}else if("excel"==filetype){
					$("#centerMonthReport").attr("action","${ctx}/exportMonthExcel/export2").submit();
				}
			}
		}

	}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值