双iframe问题

时间:2011-06-14 08:46:15

标签: html

我有一个包含2个iframe的页面,其中包含3个文件。第二个iframe里面有一个表单,如下所示:

用户访问的页面(http://domain1.com/index.html):

<html>
<head>
</head>
<body>
    <iframe name="ifr1" src="http://domain2.com/index.html" width="800" height="1000" scrolling="no">
    </iframe>
</body>
</html>

domain2.com/index.html的页面

 <html>
 <head>
 </head>
 <body>
 <iframe name="ifr2" src="http://domain3.com/form.html" width="400" height="400" scrolling="no">
    </iframe>
 </body>
 </html>

domain3.com/form.html的页面

 <html>
 <head>
 </head>
 <body>
 <form method='post' action='http://domain3.com/check.php' target='_parent' id='cform'>
    <input type="text" name="inp1">
    <input type="submit" value="send">
 </form>
 </body>
 </html>

因此,当用户访问domain1.com/index.html时,结果html变为:

<html>
<head>
</head>
<body>
    <iframe name="ifr1" src="http://domain2.com/index.html" width="800" height="1000" scrolling="no">
        <html>
        <head>
        </head>
        <body>
        <iframe name="ifr2" src="http://domain3.com/form.html" width="400" height="400" scrolling="no">
             <html>
             <head>
             </head>
             <body>
             <form method='post' action='http://domain3.com/check.php' target='_parent' id='cform'>
                 <input type="text" name="inp1">
                 <input type="submit" value="send">
             </form>
             </body>
             </html>
        </iframe>
        </body>
        </html>
    </iframe>
</body>
</html>

当用户提交表单时,我想在名为ifr1的iframe中加载http://domain3.com/check.php内容,但是在提交表单时,它会在新窗口/选项卡中加载check.php内容。

我更改了check.php的域名,并将其复制到domain2中以检查它是否有效,并且确实如此。这是否意味着将表单内容发送到其他域是错误的?有人对此有任何想法吗?

非常感谢! :)

1 个答案:

答案 0 :(得分:0)

iframes不再适用于拉入多个文件。看起来你所拥有的只是表格和表格检查。您可以将您拥有的代码转换为php并使用include()vs iframe。

对某些php tutorials

采取措施

您的支票文件有何功能?