子窗口调用父窗口的东东(控件或者方法):
1. window.open打开的子窗口有window.opener属性
子窗口通过window.opener.xxxx获得父窗口的东东。
如:window.opener.document.getElementById("userName");得到父页面的控件。
window.opener.fresh();调用父页面的js方法。
2. window.showModalDialog:不支持window.opener,
子窗口通过window.dialogArguments.xxxx获得父窗口的东东。
父窗口通过showModalDialog(url,para,feature)第二个参数para传参数给子窗口,
子窗口通过window.dialogArguments获得父窗口穿过来的东西。
如:这里传父页面的window过去
父页面:showModalDialog(url,window,feature)
子页面:var name = window.dialogArguments.document.getElementById("userName").value;得到父页面的控件。
var name = window.dialogArguments.fresh();调用父页面的方法。
这里的window.dialogArguments里的window代表父页面的window,它是通过showModalDialog方法的第二个参数window传过来的,
1. window.open打开的子窗口有window.opener属性
子窗口通过window.opener.xxxx获得父窗口的东东。
如:window.opener.document.getElementById("userName");得到父页面的控件。
window.opener.fresh();调用父页面的js方法。
2. window.showModalDialog:不支持window.opener,
子窗口通过window.dialogArguments.xxxx获得父窗口的东东。
父窗口通过showModalDialog(url,para,feature)第二个参数para传参数给子窗口,
子窗口通过window.dialogArguments获得父窗口穿过来的东西。
如:这里传父页面的window过去
父页面:showModalDialog(url,window,feature)
子页面:var name = window.dialogArguments.document.getElementById("userName").value;得到父页面的控件。
var name = window.dialogArguments.fresh();调用父页面的方法。
这里的window.dialogArguments里的window代表父页面的window,它是通过showModalDialog方法的第二个参数window传过来的,