将值从子级传递给父级并在父级表单中设置值以保存子级详细信息

发布于 2024-11-30 03:25:58 字数 139 浏览 0 评论 0原文

我有一个 Child javascript 弹出窗口 jsp,它生成动态值表。我希望将这些表值传递到父窗口 jsp,然后单击“提交要存储在数据库中的子详细信息”。

父级使用的表单需要处理来自子级的表内容列表并执行保存过程

问候 罗恩

I have a Child javascript popup window jsp which generates dynamic table of values. I want these table values to be passed to the Parent window jsp and from there on click of Submit the child details to be stored in DB.

The Form which is used by the parent needs to handle these list of table contents coming from Child and do the saving process

Regards
Ron

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隱形的亼 2024-12-07 03:25:58

使用 window.opener 对象与父级进行通信。直接与父元素交互

window.opener.document.getElementById()

或调用父函数并传递要作为参数提交的数据

window.opener.parent_func(dataToSubmit)

。您可以设置表单的值并在此函数中提交它。
如果数据是子窗口的各个字段值,那么您可以使用打开子窗口时使用的变量从父窗口获取子窗口的元素,如下所示

var childObj=window.open(options);

使用 childObj 现在获取子窗口的数据: childObj.document.getElementById()

Use window.opener object to communicate to the parent. Either directly interact with the parent elements

window.opener.document.getElementById()

or call a parent function and pass the data to be submitted as arguement

window.opener.parent_func(dataToSubmit)

You can set the values of your form and submit it in this function.
If the data is individual field values of the child window then you can use the variable used while opening of the child window to get the child window's elements from parent as follows

var childObj=window.open(options);

use childObj to get child window's data now as childObj.document.getElementById()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文