您的位置:首页 > 其它

让一个表单根据不同的情况提交给两种不同的方法处理

2015-08-14 09:42 525 查看
<form method="post" action="" id="subForm" name="form1">

<table>

<tr>

  <td></td>

  <td></td>

</tr>

</table>

</form>

导航条上面有批量删除(onclick="delall()")和批量下载(onclick="downall()")两个按钮

第一种情况:表单里面没有提交按钮(submit)

js里面写:

delall(){

document.form1.action="__APP__/Document/Collection/delFile"; //改变form里面action的值
$("#subForm").submit(); //提交表单

}

downall(){

document.form1.action="__APP__/Document/Collection/downFile";
$("#subForm").submit();

}

第二种情况:表单里面有提交按钮

delall(){

document.form1.action="__APP__/Document/Collection/delFile"; //改变form里面action的值

}

downall(){

document.form1.action="__APP__/Document/Collection/downFile";

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: