form 表单提交 疑问
<form onsubmit="return delInfo()" action="" method="post" >
<table>
<tr><td>aa</td></tr>
</table>
<input type="submit" value="全部删除" >
<input type="submit" value="发送信息" >
</form>
--------------------------
怎么在一个form 里面可以点击不同的按钮 连接不用action 方法地址
[解决办法]
<script type="text/javascript">
function del(){
document.form[0].action = "你想执行的方法";
document.form[0].submit();
}
function send(){
document.form[0].action = "你想执行的方法";
document.form[0].submit();
}
</script>
<form method="post" >
<table>
<tr><td>aa</td></tr>
</table>
<input type="button" value="全部删除" onclick=“del()”>
<input type="button" value="发送信息" onclick=“send()”>
</form>
[解决办法]
<script type="text/javascript">
function deleteAll(){
document.URL = "XXXX.action";
document.getElementById("bt_del").submit();
}
function sendMessage(){
document.URL = "XXXX.action";
document.getElementById("bt_send").submit();
}
</script>
<form onsubmit="return false" method="post" >
<table>
<tr><td>aa</td></tr>
</table>
<input id="bt_del" type="button" onClick="deleteAll();" value="全部删除" >
<input id="bt_send" type="button" onClick="sendMessage();" value="发送信息" >
</form>