2011-03-31 88 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

相關問題