小妹有问题请教各位大虾,很急的!!!!!关于ShowModalDialog属性的问题!!!!急!急!急!!!!

haif1978 2002-09-06 10:52:02
在一个main.asp页中用一个按钮打开一个对话框phy.asp,其中main.asp页中有三个文本框,要把其中的值,作为参数传送到phy.asp页中,是用一个一维数组传递的,我在phy.asp页中定义了一个数组temp[]用来存放从main.asp页中传来的参数,用到了对话框自带的接收属性dialogArguments[]把它其中的值放入到temp[]中,但要提交信息的时候总是提示dialogArguments未定义,我在main.asp页中有将session值清空的操作,但在phy.asp页中我只是把从main.asp页在传来的值送入到了三个session值中,并没有清空它,为什么会出现dialogArguments未定义的错误提示,再就是用showModalDialog打开一个对话框(实际就是一个窗口)在关闭它的时候,为什么总弹出一个窗口,我于是在提交数据之后,写上的"数据提交成功,请返回"的字样,就这样,它出现了变量未定义的错误,请各位大虾帮帮忙,我就快不行了,多谢了!!!!!真是十分感谢!!!!!再次感谢!!!!!!!!!!!!!
...全文
153 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2002-09-07
  • 打赏
  • 举报
回复
vArguments如果是String有64K的大小限制
孟子E章 2002-09-07
  • 打赏
  • 举报
回复
关于参数:
语法:vReturnValue = window.showModalDialog(url,vArguments)
是用vArguments和window.returnValue来和打开它的父窗口进行传递信息的。
有传入和传出2个情况。

vArguments是传入,可以是数组等对象。window.dialogArguments接受它。
window.returnValue把window.showModalDialog()里的数据返回。用vReturnValue 接收,明白了这个一切ok
孟子E章 2002-09-07
  • 打赏
  • 举报
回复
可以实现,以下是测试文件:

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")
%>
superhasty 2002-09-06
  • 打赏
  • 举报
回复
上面说得很详细了!
模态对话框中通常不要用提交方式(SUBMIT)更新数据,因为提交一定会出现一个窗口的.
你可以将数据传回到父窗体再在父窗体中提交,或者用其他方式保存数据.
meizz 2002-09-06
  • 打赏
  • 举报
回复
showModalDialog(sURL [, vArguments] [, sFeatures])
//打开一个模式对话框
//vArguments=需要向新开模式对话框传递的参数
//sFeatures=(*dialogHeight:sHeight;dialogLeft:sXPos;
dialogTop:sYPos;dialogWidth:sWidth;
center:{ yes | no | 1 | 0 | on | off };
dialogHide:{ yes | no | 1 | 0 | on | off };
edge:{ sunken | raised };
help:{ yes | no | 1 | 0 | on | off };
resizable:{ yes | no | 1 | 0 | on | off };
scroll:{ yes | no | 1 | 0 | on | off };
status:{ yes | no | 1 | 0 | on | off };
unadorned:{ yes | no | 1 | 0 | on | off };*)


---- 在传统的WINDOWS EXE程序中,模态对话框经常出现。例如,写字板程序(WORDPAD.EXE)中的“查看/选项(O)...”菜单被点中后,跳出“选项”对话框,用户一定要响应该对话框,如果该对话框不关闭,是无法回到主窗口的。这经常被应用于要求用户输入多个参数的场合。我们在浏览器中也可以简单地实现该功能。
---- 在IE浏览器中,要求用户输入可以使用VBScript的INPUTBOX函数、或者J Script的window.prompt方法,但是界面都比较单调,并且只能传递一个参数,而用DHTML来实现就灵活多了。

---- 1. 基本语法

---- window对象有一个方法称为showModalDialog,我们可以在页面按钮的onclick中写如下代码:

< BUTTON onclick="window.showModalDialog
('dialog.htm')" >Search< /BUTTON >

---- 系统会在新窗口中打开dialog.htm页面,并且等待用户响应,如果用户不响应该页面,那么主页面将得不到光标。
---- 在dialog.htm中设置window对象的returnValue属性,就可以让主页面得到返回值。例如,在页面的确定按钮的onclick中写:

window.returnValue = window.
document.all.iptPeopleID.value

---- 将输入框iptPeopleID的值赋给window对象的returnValue属性。在主页面中就可以得到这个值:
var str = showModalDialog("dialog1.htm")

---- 2. 传递初始化值
---- 如果要向模态页面中传递初始化值,可以在主页面中用如下语句:

var cSearchValue=showModalDialog
('dialog.htm', 'ABC')
在dialog.htm中使用window.dialogArguments
属性可以得到'ABC'。例如:
< SCRIPT FOR=window EVENT=onload LANGUAGE="JScript" >
if (window.dialogArguments != null)
window.document.all.iptPeopleID.value = window.dialogArguments;
< /SCRIPT >

---- 3. 传递多个数值
---- 如果要向模态页面中传递多个参数,可以先在主页面中定义一个对象,

function myDialog() {
var str1;
var str2;
}

---- 显示模态页面之前初始化该对象,然后调用showModalDialog方法。
function WelcomeYou(iniStr1,iniStr2) {
myDialog.str1 = iniStr1;
myDialog.str2 =iniStr2 ;

if (showModalDialog("dialog2.htm", myDialog)
==false) //将对象传入
......

---- 在模态页面中,可以用这样的代码
window.document.all.iptID.value=
window.dialogArguments.str1
来引用数值,或者用这样的代码对之赋值
window.dialogArguments.str1 =
window.document.all.iptID.value

---- 完整例程如下:
---- 对于只传递一个参数的情况,见:Main1.htm和dialog1.htm。

---- 对于传递多个参数的情况,见:Main2.htm和dialog2.htm。


父窗体:
dim xxx '返回值
dim yyy '传到子窗体的参数
var xxx = ShowModalDialog('xxx.asp','yyy','dialogWidth:100px;DialogHeight=290px;status:no')
子窗体:
dim yyy '从父窗体传来的参数
dim xxx '传回父窗体的参数
yyy = window.dialogArguments
xxx = window.returnValue
cross311 2002-09-06
  • 打赏
  • 举报
回复
看的我眼睛都花了
ksy 2002-09-06
  • 打赏
  • 举报
回复
说了这么一大堆,还不如贴一段相关源码。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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