2011-03-31 37 views
1

我想将表单提交到与表单相同的页面上的iFrame。 我使用Target =“iframe_results”,其中iframe_results是iframe的名称。提交带有iFrame目标的表单

这在Firefox和Chrome中运行良好,但在IE中弹出了一个新标签页/窗口。

我尝试使用JavaScript来做提交(如其他来源所述),但这仍然没有奏效。

回答

1

您使用的是什么版本的IE?我实现了这个方法,而无需任何问题,任何

http://www.openjs.com/articles/ajax/ajax_file_upload/

<form id="file_upload_form" method="post" enctype="multipart/form-data" action="upload.php"> 
<input name="file" id="file" size="27" type="file" /><br /> 
<input type="submit" name="action" value="Upload" /><br /> 
<iframe id="upload_target" name="upload_target" src="" style="width:0;height:0;border:0px solid #fff;"></iframe> 


function init() { 
    document.getElementById('file_upload_form').onsubmit=function() { 
     document.getElementById('file_upload_form').target = 'upload_target'; //'upload_target' is the name of the iframe 
    } 
} 
+0

不幸的是,它不是在IE8工作。此表单位于Facebook应用程序的iframe中。看到这里:http://apps.facebook.com/readinglist/ – Ernest 2011-03-31 06:04:34

+0

现在不能检查出来,在工作:) – JohnP 2011-03-31 06:06:13

+0

不用担心的人。我会继续测试不同的想法,直到我解决它。 – Ernest 2011-03-31 06:33:57

相关问题