HTML表单目标指向IFRAM在FF中工作,但不是IE [英] HTML Form Target directed to IFRAM working in FF but not IE

查看:158
本文介绍了HTML表单目标指向IFRAM在FF中工作,但不是IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由两个不同目标组成的表单。一个目标提交表单,另一个目标提供表单数据的预览。我唯一的问题是,我的逻辑在firefox中工作正常,但是当我单击预览按钮时,要显示预览的iframe保持空白。我还注意到表单数据在父URL(文本字段,选择等等)中列出,这应该不会发生,因为目标是指向iframe而不是父级。我在IE中更改了我的安全设置,并确认iframe在正常情况下的功能正常。任何建议,我可能做错了什么?



表格逻辑:

 < form name =sourceConfigFormonSubmit =return OnSubmitForm(); return false;> 
...
< INPUT TYPE =SUBMITname =OperationonClick =document.pressed = this.valueVALUE =Submit>
< INPUT TYPE =SUBMITname =Operationid =previewButtononClick =document.pressed = this.valueVALUE =预览XML>
< / form> ;

IFRAME声明:

 < IFRAME SRC =NAME =previewFrameid =previewFrameWIDTH =300pxHEIGHT =400pxFRAMEBORDER =0>< / IFRAME> 

在表单提交时调用的java脚本:

<$ p $如果(document.pressed =='Preview XML')
{
$ b $ document.sourceConfigForm。 target ='previewFrame';
//动作调用弹簧控制器
document.sourceConfigForm.action =XMLPreview;
}
else
if(document.pressed = ='Submit')
{
document.sourceConfigForm.target =;
//动作调用弹簧控制器
document.sourceConfigForm.action =AddSourceConfig;
}
}


解决方案

保持iframe在表单标签内,至少这对我有用。


I have a form which consists of two different targets. One target submits the form and the other presents a preview of the form data. My only issue here is that my logic works fine in firefox however the iframe in which the preview is to be displayed remains blank when I click the preview button. I've also noticed the form data being listed in the parent URL(text fields,selections ,etc...) , which shouldn't happen since the target is pointing to the iframe and not the parent. I've changed my security settings in IE and have confirmed that iframes do function correctly under normal circumstances. Any suggestions on what I could be doing wrong?

The Form logic:

<form name="sourceConfigForm" onSubmit="return OnSubmitForm();return false;">
...
<INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Submit">
<INPUT TYPE="SUBMIT" name="Operation" id="previewButton" "onClick="document.pressed=this.value" VALUE="Preview XML">
</form>

The IFRAME Declaration:

<IFRAME SRC="" NAME="previewFrame" id="previewFrame"  WIDTH="300px" HEIGHT="400px" FRAMEBORDER="0"></IFRAME>

The java script called on form submission:

 function OnSubmitForm()
 {
   if(document.pressed == 'Preview XML')
   { 

     document.sourceConfigForm.target='previewFrame';
      //action calls spring controller
     document.sourceConfigForm.action ="XMLPreview"; 
   }
   else
   if(document.pressed == 'Submit')
   {
     document.sourceConfigForm.target="";
      //action calls spring controller
     document.sourceConfigForm.action ="AddSourceConfig";
   }
 }

解决方案

Keep the Iframe within form tag, atleast this worked for me.

这篇关于HTML表单目标指向IFRAM在FF中工作,但不是IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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