<form action="http://localhost/action1.jsp" name="outer" onsubmit="window.frames['ccgp'].document.outer.submit()">
<input type=text name="title" value="">
</form><iframe name="ccgp" style="display:none" src="iframe.jsp" target="_blank">
<form action="http://localhost/action2.jsp" name="outer">
<input type=hidden name="title" value="">
</form>
</iframe>
</html>

解决方案 »

  1.   

    思路应该是这样的:
    1、分别给两个form不同的命名
    2、提交的时候使用js脚本各自提交
    3、参考下面:<form action="http://localhost/action1.jsp" name="outer">
    <input type=text name="title" value="">
    <input type=button name='outerSubmit' onclick='document.all.outer.submit();'>
    </form><iframe id="ccgp" style="display:block" src="">
    <form action="http://localhost/action2.jsp" name="inner">
    <input type=hidden name="title" value="">
    <input type=button name='innerSubmit' onclick='document.all.inner.submit();'>
    </form>
    </iframe>
    </html>
      

  2.   

    不好意思,页面应该是这样的。
    <form action="http://localhost/action1.jsp" name="outer" onsubmit="fun()"> 
    <input type=text name="title" value=""> 
    </form> 
     
    <iframe id="ccgp" style="display:none"> 
    <form action="http://localhost/action2.jsp" name="inner"> 
    <input type=hidden name="title" value=""> 
    </form> 
    </iframe> 
    </html>
    其中fun()这个方法应该怎样写呢?
      

  3.   

    fun要实现提交两个表单,还有向iframe表单赋值
      

  4.   

    function fun(){
    window.frames['ccgp'].document.outer.submit();
    }
      

  5.   

    function fun(){window.frames['ccgp'].document.outer.elements["title"].value=document.outer.elements["title"].value
    window.frames['ccgp'].document.outer.submit();
    }
      

  6.   


    function fun(){
    window.frames['ccgp'].document.title.value=window.document.all.title.value;
    ...//此处可以添加提交其它表单而不能是外部的outer,只是fun()是你的外部表单outer的onsubmit触发提交因此你不可以在这里再次提交该表单
    window.frames['ccgp'].document.outer.submit();
    }
      

  7.   

    to net_lover(孟子E章) 
    奇怪!我用您的方法就是得不到iframe中的表单对象
      

  8.   

    我是这样写的
    function fun(){ 
    window.frames['ccgp'].document.inner.elements[ "title "].value=document.outer.elements[ "title "].value;///////////这行就报错了
    window.frames['ccgp'].document.inner.submit();
    document.outer.submit();
    }
      

  9.   

    你表单的名字对吗?
    不要用title等关键字
    iframe的name不是id
    [ "title "]里面有空格
      

  10.   

    iframe对象可以得到,而且iframe.innerHTML也打的出来是对的,在代码里没有空格的
      

  11.   

    注意body标记都要写上,例子
    1.htm
    <body>
    <form name=a action=http://community.csdn.net/  target=_blank>
    <input type=submit onclick="window.frames['c'].document.b.submit()">
    </form>
    <br>
    <iframe name=c src="2.htm"></iframe>
    </body>2.htm
    <body>
    <form name=b action="http://news.sina.com.cn" target=_blank>
    <input value="ok">
    </form>
    </body>