开发者

Submitting a form with an iFrame target

开发者 https://www.devze.com 2023-02-21 03:24 出处:网络
I want to submit a form into an iFrame on the same page as the form. I\'m using Target=\"iframe_results\" where iframe_results is the name of the iframe.

I want to submit a form into an iFrame on the same page as the form. I'm using Target="iframe_results" where iframe_results is the name of the iframe.

This works fine in Firefox and Chrome but in IE it pops open a new tab/window.

I tried using JavaScript to do the submits开发者_Python百科 (as outlined in other sources) but this still didnt work.


What version of IE are you using? I've implemented this method without having any issues whatsoever

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

精彩评论

暂无评论...
验证码 换一张
取 消