传回父窗口这样的功能如何做?

Itfeng 2005-11-16 08:24:17

如有一表单页面即父窗体,在其中要打开子窗体并将子窗体中的数据返回给父窗体表单中的如text等中,该如何做呢?那位能举个例子呀!(目前我只有想法,但不知道怎么做?:)请大家帮助!
...全文
62 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dh20156 2005-11-16
  • 打赏
  • 举报
回复
参考:
mdt.htm
<HEAD>
<HTML>
<HEAD>
<TITLE>showModelessDialogEX.htm</TITLE>
<SCRIPT>
var sUserName="";
/*------------------------------------------------------------
Supplying the window object as a parameter allows for declaring the global
variable, sUserName, and using it to return information from the modeless
dialog box.
------------------------------------------------------------- */
function fnCallDialog()
{
showModelessDialog("myDialog.htm",window,"status:false;dialogWidth:300px;dialogHeight:300px");
}
/*-------------------------------------------------------------
The fnUpdate function takes the value passed into sUserName in myDialog.htm
to update the span text on this page. This function is called in both
fnGetInfo and fnCancel functions in myDialog.htm.
-------------------------------------------------------------*/
function fnUpdate()
{
oName.innerText = sUserName;
}
</SCRIPT>
</HEAD>
<BODY>
<P>Enter your first name: <SPAN ID="oName"
STYLE="color:red;font-size:24">Joan</SPAN></P> <INPUT TYPE="button"
VALUE="Display Modeless Dialog" onclick="fnCallDialog()">
</BODY>
</HTML>

myDialog.htm
<HTML>
<HEAD>
<TITLE>myDialog.htm</TITLE>
<SCRIPT>
/* -------------------------------------------------------------
This function makes use of the dialogArguments property of the
window object. dialogArguments allows the global variable sUserName
to feed the value supplied to the input in this dialog box back to
the window that called it.
---------------------------------------------------------------- */
function fnGetInfo()
{
var sData = dialogArguments;
sData.sUserName = oEnterName.value;
sData.fnUpdate();
}
/* -------------------------------------------------------------
This function cleans up in case the user has clicked the
Apply button before canceling.
---------------------------------------------------------------- */
function fnCancel()
{
var sData = dialogArguments;
sData.sUserName = "Joan";
sData.fnUpdate();
}
</SCRIPT>
</HEAD>
<BODY>
<LABEL FOR="oEnterName" ACCESSKEY="f">Enter your
<SPAN STYLE="text-decoration:underline">F</SPAN>irst Name</LABEL>
<INPUT ID=oEnterName><BR><BR>
<INPUT VALUE="Apply" TYPE=button onclick="fnGetInfo();">
<INPUT VALUE="Ok" TYPE=button onclick="fnGetInfo();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="fnCancel();window.close();">
</BODY>
</HTML>
king_shadow 2005-11-16
  • 打赏
  • 举报
回复
opener.document.form2.textfield2.value=document.form1.textfield.value
dh20156 2005-11-16
  • 打赏
  • 举报
回复
有open和showModalDialog的不同处理方法。搜索一下先。

28,405

社区成员

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

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