如何实现在showmodeldialog()弹出的窗口中提交form但不弹出新窗口。

shentj 2002-07-03 06:39:19
thanks
...全文
298 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
祝邦 2002-07-06
  • 打赏
  • 举报
回复
对于这个问题,先看看这个函数的构造:
模式对话框:showModalDialog
vReturnValue = window.showModalDialog(sURL[, vArguments][, sFeatures]);

非模式对话框:showModelessDialog() (Internet Explorer 5 和以上版本)

参数说明:
·vReturnValue:对于showModalDialog(),它表示被打开的对话框窗口设置的returnValue属性值。对于showModelessDialog(),它表示新窗口对象。
显然模式返回不了弹出的对话框对象,所以上述的方法都不可行,不知道楼上的各位发布的代码都试验过了没有。人家明显是问,如何在模式对话框中指向一个新的页面,而不是弹出新的页面。
flyxing 2002-07-06
  • 打赏
  • 举报
回复
在你弹出的对话框的<Head></Head>之间加上
一句<base target="_parent">
lanbor 2002-07-04
  • 打赏
  • 举报
回复
cawangjun(心驿) lvenlee(大头) 谢谢二位指正。
我没有做实验,而想当然的轻易下结论实在是不对的。
我希望shentj不是少女,不然险些酿成大祸。哈
lvenlee 2002-07-04
  • 打赏
  • 举报
回复
3楼的纯属误道未成年少女"下海",:)
cawangjun 2002-07-04
  • 打赏
  • 举报
回复
2楼的是正确的,3楼的错了
lanbor 2002-07-04
  • 打赏
  • 举报
回复
或者把 form 的 action 设为自身页。 这样的情况下,这个页必须既能显示内容,又能处理提交表单。(用 if response("submit") <> "" then ...判断.
孟子E章 2002-07-04
  • 打赏
  • 举报
回复
办法:
window.showModalDialog("xxx.htm")

xx.htm
====================


<frameset rows="0,*">
<frame src="about:blank">
<frame src="xxx.asp">
</frameset>

xxx.asp
=========
<form target="_self" method=post>



以下是测试文件:
index.htm
=====================
<input onclick='window.showModalDialog("f.htm")' type=button value="打开">


f.htm
=================================
<frameset rows="0,*">
<frame src="about:blank">
<frame src="a.asp">
</frameset>


a.asp
===============
<script>
function test(o)
{
if(o.txt.value=="")
{
alert("不能为空")
return false
}
return true
}
</script>
<form method=post onsubmit="return test(this)" action="a.asp">
<input name=txt>
<input type=submit>
</form>

<%
Response.write "你输入的数据:" & Request.form("txt")
%>
lanbor 2002-07-04
  • 打赏
  • 举报
回复
或者你把<form action=当前网页自身>就行了,这样这个页面作到既显示内容又能处理提交表单。
meizz 2002-07-04
  • 打赏
  • 举报
回复
这种问题以前已经有人提出过了!

在主页面中加入一个<iframe name=test style="display: none"></iframe>
在showmodaldialog出来的页中用<form target=test …>…</form>。
shentj 2002-07-04
  • 打赏
  • 举报
回复
lanbor(兰波) ,我当然不是少女;)
谢谢几位
skyover 2002-07-03
  • 打赏
  • 举报
回复
那你提交到opener吧。

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧