簡體   English   中英

提交帶有iFrame目標的表單

[英]Submitting a form with an iFrame target

我想在與表單相同的頁面上將表單提交到iFrame中。 我正在使用Target =“ iframe_results”,其中iframe_results是iframe的名稱。

這在Firefox和Chrome中工作正常,但在IE中會彈出一個新標簽頁/窗口。

我嘗試使用JavaScript進行提交(如其他來源所述),但這仍然行不通。

您正在使用哪個版本的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
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM