<form method="POST" action="1.asp" name="login">
用户名<INPUT size=10 name=UserID>
密 码<INPUT type=password size=10  name=PassWord>
<input type=submit value=登录 name=Submit />
</form>
点登陆同时将数据提交到2个asp页面中比如我点登陆,则将数据提交到1.asp并且将数据提交到http://192.168.0.2/2.asp上去
难道要写2个form post ?

解决方案 »

  1.   

    提交过去不难
    只是你提交完了如何显示
    显示1.ASP还是2.ASP?还是都显示?还是都不显示?
      

  2.   


    <SCRIPT LANGUAGE="JavaScript">
    function dosubmit()
    {
    document.form1.action="1.asp";
    document.form1.target="page1";
    document.form1.submit();
    document.form1.action="2.asp";
    document.form1.target="page2";
    document.form1.submit();
    }
    </SCRIPT>
    <form id="form1" name="form1" method="post" action="1.asp" onsubmit="return dosubmit()"> 
    <INPUT TYPE="submit">
    </form>给个例子 要睡觉了 就这么个意思 TARGET来控制提交显示
    想要不显示 就放到一个隐藏的iframe里面去 target对应iframe的name属性
    例如 2.asp不显示 document.form1.target="page2";
    那么对应的<iframe name="page2" src="" style="display:none"></iframe>
      

  3.   


    <SCRIPT LANGUAGE="JavaScript">
    function dosubmit()
    {
    document.form1.action="1.asp";
    document.form1.target="page1";
    document.form1.submit();
    document.getElementById("div1").style.display="none";
    document.getElementById("page1").style.display="";
    document.form1.action="2.asp";
    document.form1.target="page2";
    document.form1.submit();
    }
    </SCRIPT>
    <div id="div1">
    <form id="form1" name="form1" method="post" action="1.asp" onsubmit="return dosubmit()"> 
    <INPUT TYPE="submit">
    </form>
    </div>
    <iframe id="page1" name="page1" src="" style="display:none"> </iframe>
    <iframe id="page2" name="page2" src="" style="display:none"> </iframe>
      

  4.   

    代码不错,的确有效。不过有个小问题
    比如我1.asp(page1)不显
    而2.asp(page2)要target="_self" 本页显示
    是不是这样?<SCRIPT LANGUAGE="JavaScript">
    function dosubmit()
    {
    document.form1.action="http://192.168.0.1/1.asp";
    document.form1.target="page1";
    document.form1.submit();
    由于网速问题需要在这延迟一下吗?否者可能2比1先提交,那么1就接收不到数据了,变成直接就转到2.asp了document.form1.action="http://192.168.0.2/2.asp";
    document.form1.target="_self"
    document.form1.submit();
    }
    </SCRIPT>
    <div id="div1">
    <form id="form1" name="form1" method="post" action="" onsubmit="return dosubmit()"> 
    <INPUT TYPE="submit">
    </form>
    </div>
    <iframe id="page1" name="page1" src="" style="display:none"> </iframe>
      

  5.   

    neo_yoho 再帮忙看看,只有个小小的问题啦!
    这个搞定就结贴给分了
      

  6.   

    用脚本创建二个form,把form对象的的action分别改成1.asp和2.asp,再分别提交即可.
      

  7.   


    <SCRIPT LANGUAGE="JavaScript"> 
    function dosubmit() 

    document.form1.action="http://192.168.0.1/1.asp"; 
    document.form1.target="page1"; 
    document.form1.submit(); 
    //由于网速问题需要在这延迟一下吗?否者可能2比1先提交,那么1就接收不到数据了,变成直接就转到2.asp了
    setTimeout(check,200);

    function check()
    {
    if(document.getElementById("page1").contentWindow.readyState!="complete")
    {
    document.form1.action="http://192.168.0.2/2.asp"; 
    document.form1.target="_self" 
    document.form1.submit();
    }
    else
    setTimeout(check,200);
    }
    </SCRIPT> 
    <div id="div1"> 
    <form id="form1" name="form1" method="post" action="" onsubmit="return dosubmit()"> 
    <INPUT TYPE="submit"> 
    </form> 
    </div> 
    <iframe id="page1" name="page1" src="" style="display:none"> </iframe> 试试这样
      

  8.   

    上面的错了
    if(document.getElementById("page1").contentWindow.readyState!="complete")
    改成
    if(document.getElementById("page1").contentWindow.document.readyState=="complete")不过这个也只是IE有效如果是同域内的页面 你可以在先提交的页面里用window.onload事件来提交此FORM
    如果是用6楼的例子就没事 如果FORM的内容不多 用ajax来提交也不错
      

  9.   

    如果你一定是要_self打开
    那么2.asp用ajax来提交 确定提交完成的时候再来提交1.asp
    前提是不能跨域执行 就是不要提交到别的网站上去