日期:2014-05-20 浏览次数:20783 次
<form action="" id="form1"> <input type="submit" name="update" value="更新" onclick="setAction(1)"> <input type="submit" name="delete" value="删除" onclick="setAction(2)"> </action> <script> function setAction(type){ if(type == 1){ document.getElementById("form1").action = "a.do" } else if(type == 2){ document.getElementById("form1").action = "b.do" } } </script>
------解决方案--------------------
3#楼是对的!可以按他的写
也可以这样,然后在action中进行处理
<form action="" id="form1"> <input type="submit" name="update" value="更新" onclick="setAction('update')"> <input type="submit" name="delete" value="删除" onclick="setAction('delete')"> </action> <script> function setAction(typeName){ document.getElementById("form1").action = "a.do?method=xxx&typeName="+typeName; document.action.submit(); } </script>
------解决方案--------------------
<form action="" id="form1">
<input type="submit" name="update" value="更新" onclick="location.href='a.do'"/>
<input type="submit" name="delete" value="删除" onclick="location.href='b.do'"
/>