showModalDialog()、showModelessDialog()方法时参数传递的问题 给iframe设置一个name,然后设置表单的target不行吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 模态对话框是不能提交给自己的,包括提交给模态对话框里的iframe也不行, 一提交就会跳出新网页. 当然模态对话框也不接受表单的提交, 解决你这人问题的办法就是用打开模态对话框时的第二个参数(vArguments) 举个例子:showModalDialog('tt.htm', 'meizz','dialogWidth:360px;dialogheight:120px;status:no;help:no')在tt.htm里:<iframe name=contentIframe style="scroll:no;" frameborder=0 width=100% height=100% ></iframe><script language="javascript"><!--if (window.dialogArguments != null) window.document.all.contentIframe.src = "abc.asp\?msg="+ window.dialogArguments;</script>这样就把你想要的信息传进去了,当然你还将一个数组组装成一个字符传进去以后再解开来就可以传递更多的内容了.传值方法二:showModalDialog('tt.asp\?msg=meizz', '','dialogWidth:360px;dialogheight:120px;status:no;help:no')用这种方法直接将值赋在模态对话框的链接上,然后到了对话框里你自己再接收处理 模态对话框可以提交给自己, 不过不要用iframe,用frame,我就是这样做的,把一个frame隐藏掉,另外一个提交的时候把taget="_self",就行了例frame.html<frameset rows="0,*"> <frame src="about:blank" frameborder="0" noresize width="0" height="0" style="display: none;"> <frame src="AddCard.html" frameborder="0"></frameset>AddCard.html...<form action="frame.dll" method="post" target="_self" name="fr_card" id="fr_card" onsubmit="return check()" enctype="multipart/form-data">... http://www.csdn.net/Develop/read_article.asp?id=15113 楼上的两种方法都是可以的,但是都有受到参数或参数内容过多的限制。楼主对这种方法我想应该也知道,但好象又只能用这种方法而不能用form提交。对于form提交只能用于window.open的形式,其实你可以将窗口模拟做成对话框的样子。楼主好久没有见到过你了:) 主要原因在于要传递一个paramKeyWhere,数据库中某个表的主键信息,内容可能较多,可能存在各种特殊字符,直接挂在url可能会出错;最后通过传递window对象,将表单的action和相关参数赋给模态窗口中的一个隐藏表单,将原表单的数据进行提交;谢谢大家的帮助。表单页面=======================var frmSubmitToModalDialog;//该对象将被模态窗口用到function setTask(operate){ frmSubmitToModalDialog=document.all(frmName);//frmName是某个form的名字 frmSubmitToModalDialog.action="/nmbpmp/time/activity/setTask.jsp?paramTableName=<%=strTableName%>¶mLocate="+operate; var returnValue=showModalDialog("/comDB/ModalDialog.htm",window,"dialogHeight:500px;dialogWidth:450px;help:no;status:no;scroll:0;center:yes"); return;}模态窗口页面=======================function loadContent(){ var win=winOpener; var frm=win.frmSubmitToModalDialog; document.frmHidden.target="iframeContent"; document.frmHidden.action=frm.action; if(frm.paramKeyWhere)document.frmHidden.paramKeyWhere.value=frm.paramKeyWhere.value; document.frmHidden.submit();}<iframe id=iframeContent name=iframeContent style="scroll:no;" frameborder=0 width=100% height=100% ></iframe><div style="display:none"> <form name=frmHidden target=iframeContent action=""> <input name=paramTableName> <input name=paramKeyWhere> </form></div>再次感谢大家的支持。 ps:Andrawu(晓彬),一别经月,霜染青丝,郁结衷肠;一朝顿悟,弹指破三界,挥手出五行 传值的问题 js搜索XML js 传参问题 急速请教jsp问题 如何将好多行的JAVASCRIPT脚本合成一行,不留空格? jQuery 表格单元格合并 100分求《javascript权威指南》配书源码 请教, 如何给选定的内容前后加上一些东西. 大家帮我看看js错在哪里1 请问网页中JScript的程序代码的加密如何解? window.open显示窗体初始位置 那位兄弟能够给一个通过opner修改父窗体html代码的例子
showModalDialog('tt.htm', 'meizz','dialogWidth:360px;dialogheight:120px;status:no;help:no')在tt.htm里:
<iframe name=contentIframe style="scroll:no;" frameborder=0 width=100% height=100% ></iframe>
<script language="javascript"><!--
if (window.dialogArguments != null)
window.document.all.contentIframe.src = "abc.asp\?msg="+ window.dialogArguments;
</script>这样就把你想要的信息传进去了,当然你还将一个数组组装成一个字符传进去以后再解开来就可以传递更多的内容了.传值方法二:
showModalDialog('tt.asp\?msg=meizz', '','dialogWidth:360px;dialogheight:120px;status:no;help:no')
用这种方法直接将值赋在模态对话框的链接上,然后到了对话框里你自己再接收处理
例
frame.html<frameset rows="0,*">
<frame src="about:blank" frameborder="0" noresize width="0" height="0" style="display: none;">
<frame src="AddCard.html" frameborder="0">
</frameset>AddCard.html
...
<form action="frame.dll" method="post" target="_self" name="fr_card" id="fr_card" onsubmit="return check()" enctype="multipart/form-data">
...
楼主对这种方法我想应该也知道,但好象又只能用这种方法而不能用form提交。
对于form提交只能用于window.open的形式,其实你可以将窗口模拟做成对话框的样子。楼主好久没有见到过你了:)
=======================
var frmSubmitToModalDialog;//该对象将被模态窗口用到function setTask(operate){
frmSubmitToModalDialog=document.all(frmName);//frmName是某个form的名字
frmSubmitToModalDialog.action="/nmbpmp/time/activity/setTask.jsp?paramTableName=<%=strTableName%>¶mLocate="+operate;
var returnValue=showModalDialog("/comDB/ModalDialog.htm",window,"dialogHeight:500px;dialogWidth:450px;help:no;status:no;scroll:0;center:yes");
return;
}
模态窗口页面
=======================
function loadContent(){
var win=winOpener;
var frm=win.frmSubmitToModalDialog;
document.frmHidden.target="iframeContent";
document.frmHidden.action=frm.action;
if(frm.paramKeyWhere)document.frmHidden.paramKeyWhere.value=frm.paramKeyWhere.value;
document.frmHidden.submit();
}<iframe id=iframeContent name=iframeContent style="scroll:no;" frameborder=0 width=100% height=100% >
</iframe><div style="display:none">
<form name=frmHidden target=iframeContent action="">
<input name=paramTableName>
<input name=paramKeyWhere>
</form>
</div>再次感谢大家的支持。
ps:Andrawu(晓彬),一别经月,霜染青丝,郁结衷肠;一朝顿悟,弹指破三界,挥手出五行