jQuery的弹出窗口返回值到父 [英] jQuery Popup Window Return Value to Parent

查看:359
本文介绍了jQuery的弹出窗口返回值到父的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能实现使用jQuery如下:打开一个弹出窗口,返回一个值在子窗口中点击一个链接时,父窗口,关闭子窗口,然后让家长自动提交基于表单返回值?

How can I accomplish the following using jQuery: Open a popup window that returns a value to the parent window when a link in the child window is clicked, close the child window, and then have the parent automatically submit a form based on the value returned?

我意识到jQuery的对话是一种流行的解决方案,但我需要一个弹出式窗口,因为该窗口中的内容必须通航,我希望避免使用jQuery的对话框中的iframe。

I realize that the jQuery Dialog is a popular solution, but I require a popup window because the window's contents need to be navigable, and I want to avoid using an iframe in the jQuery Dialog.

弹出窗口将被用于收集多个值,最终返回为分隔字符串到母体,但这个数据收集需要发生之前提交父窗口的形式下。如果有一个标准设计模式为实体选取器,这将是它。

The popup window is going to be used to collect more than one value, ultimately to be returned as a delimited string to the parent, but this data collection needs to occur prior to the submission of the parent window's form. If there were a standard design pattern for an "Entity Picker", this would be it.

这需要在IE8,FF3.6的Safari 4和Chrome 5的工作。

This needs to work in IE8, FF3.6, Safari 4, and Chrome 5.

谢谢, 马克

推荐答案

下面是我的解决办法:

var parent = $(parent.document.body);
$(parent).find('input#valStore').val(theVal);
$(parent).find('form#myForm').submit();
window.close();

这篇关于jQuery的弹出窗口返回值到父的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆