使用表单定位Iframe会导致打开新窗口 [英] Targetting Iframe with Form causes new window to open

查看:97
本文介绍了使用表单定位Iframe会导致打开新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个创建iframe的jquery调用



<$ ()函数(){

$('< iframe />')。appendTo('body')。attr( {'id':'iframeUploader','name':'iframeUploader'})。hide();
});

当我使用表单上传时,chrome会打开一个新窗口,而不是定位iframe

 < form id =form1name =form1enctype =multipart / form-datamethod =postaction = upload.php?productID = 1074target =iframeUploader> 

任何人都可以发现我做错了什么吗?

谢谢!

解决方案

请阅读此处: http ://terminalapp.net/submitting-a-form-with-target-set-to-a-script-generated-iframe-on-ie/
事实上,在我切换到这个之后:

  $('< iframe name =iframeUploader/>')。appendTo('body')。attr({ 'id':'iframeUploader'}); 

有效。尝试在IE8和FF3.6


I am working in chrome v. 12.

I have a jquery call which creates an iframe

$(document).ready(function(){

$('<iframe />').appendTo('body').attr({'id': 'iframeUploader', 'name':'iframeUploader'}).hide();
});

when I use a form to upload, chrome opens a new window instead of targetting the iframe

<form id="form1" name="form1" enctype="multipart/form-data" method="post" action="upload.php?productID=1074" target="iframeUploader">

Can anyone spot what I am doing wrong? I'm pulling my hair out!

Thanks!

解决方案

Read here: http://terminalapp.net/submitting-a-form-with-target-set-to-a-script-generated-iframe-on-ie/ Indeed, after I switched to this:

 $('<iframe name="iframeUploader"/>').appendTo('body').attr({'id': 'iframeUploader'});

it worked. Tried it in IE8 and FF3.6

这篇关于使用表单定位Iframe会导致打开新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆