源于生活
标题:
form如何将同一个表单的值提交到两个不同的页面
[打印本页]
作者:
kevin-ying
时间:
2014-2-15 11:38
标题:
form如何将同一个表单的值提交到两个不同的页面
用JS来给ACTION赋值然后再提交
——————————————
<script>
function subform(i)
{
var theform=document.form1;
theform.action=i;
theform.submit();
}
</script>
<form name="form1">
<input name="" type="text" value="1fdsa"/>
<input name="提交" type="button" onClick="subform('11.asp')" id="提交" value="提交" />
<input name="新" type="button" onClick="subform('22.asp')" id="新" value="新" />
<input name="新2" type="button" onClick="subform('33.asp')" id="新2" value="新2" />
</form>
复制代码
作者:
kevin-ying
时间:
2014-2-15 12:23
下面的代码是已测试通过的
<script> function send_2page_f(formname,page1,target1,page2,target2)
{
with(eval("document."+formname))
{
action=page1
target=target1
submit()
action=page2
target=target2
submit()
} } </script> <form name="form">
<input type="button" onclick='send_2page_f("form","01.asp","01","02.asp","02")' value="提交">
</form>
复制代码
_____________________________________________________________________________
我的改写,用图片提交:
<script language="javascript">
function send_2page_f(formname,page1,target1,page2,target2)
{
with(eval("document."+formname))
{
action=page1
target=target1
submit()
action=page2
target=target2
submit()
} } </script><form name="search" method="post">
<tr>
<td height="20" align="center" width="330"><input name=txtitle type=Text id=txtitle size=40 maxlength=50 /></td><td >
<INPUT type=image onclick='send_2page_f("search","searchnews.asp","01","search.asp","02")' height=20 width=54 style="border:0px;" src="images/2/index_38.gif"></td>
</tr>
</form>
复制代码
欢迎光临 源于生活 (http://bbs.vingoo.info/)
Powered by Discuz! X3.1