急!一个form,两个button,如何跳转提交到两个不同页面呢?谢谢!

june37 2003-10-21 02:41:43
function add_del(nextpage)
{
document.chioceForm.action=nextpage;
document.choiceForm.ip_addr.value="";
for(var i = 0; i < choiceForm.choiceBox.length; i++)
document.choiceForm.ip_addr.value = document.choiceForm.ip_addr.value + document.choiceForm.choiceBox.options[i].text + "\n";
document.choiceForm.submit();
<form name="choiceForm" method="POST">
。。。
<input type="button" value="确 定" onclick="javascript:add_del('pladdview.jsp')">
<input type="button" value="删 除" onclick="javascript:add_del('pldelview.jsp')">
这样那里出错了呢?该怎么改!
...全文
226 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
june37 2003-10-22
  • 打赏
  • 举报
回复
问题解决了,我是把他提交到一个页面,在按钮上设两个参数,提交到一个页面就可以了!
jackal81 2003-10-21
  • 打赏
  • 举报
回复
<form name="c">
有两个select的表单
</form>
<form name="a">
<input type="hidden" name="test1">
<input type="hidden" name="test2">
<input type="button" value="submit A" onclick="this.form.test1.value=document.c.selcyer.value;this.form.test2.value=document.c.selcmon.value;this.form.submit();">
</form>
<form name="b">
<input type="hidden" name="test1">
<input type="hidden" name="test2">
<input type="button" value="submit B" onclick="this.form.test1.value=document.c.selcyer.value;this.form.test2.value=document.c.selcmon.value;this.form.submit();">
</form>
spiritsl 2003-10-21
  • 打赏
  • 举报
回复
up
alemjann 2003-10-21
  • 打赏
  • 举报
回复
同意楼上
q123a123z123 2003-10-21
  • 打赏
  • 举报
回复
只需要在函数中修改form.action属性,注意路径正确
dgyujingjun 2003-10-21
  • 打赏
  • 举报
回复
function first()
{
document.form1.action="first.jsp";
document.form1.submit();
}
function second()
{
document.form1.action="seconde.jsp";
document.form1.submit();
}

<form name="form1" method="POST">
<input type="button" value="确 定" onclick="first()">
<input type="button" value="删 除" onclick="second()">
tanndy 2003-10-21
  • 打赏
  • 举报
回复
onClick 事件加上“this.form.action=‘’”就OK了
tanndy 2003-10-21
  • 打赏
  • 举报
回复
呵呵,刚才还在用呢:)

<form action="" method="post" target="_blank">
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr align="center">
<td height="26" colspan="3" valign="top">
<input name="btnagree2" type="submit" id="btnagree23" value="结 项" onclick="this.form.action='11.html'" tabindex="1">
 
<input name="btnagree3" type="submit" id="btnagree33" value="补充材料" onclick="this.form.action='22.jsp'" tabindex="2">
 
<input name="btnagree" type="submit" id="btnagree5" value="新申请" onClick="this.form.action='33.jsp?name=2132'" tabindex="3">
</td>
</tr>
</table></td>
</tr>
</table>
</form>
凋零的老树 2003-10-21
  • 打赏
  • 举报
回复
实在不行写成两个函数

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧