我正在显示一个弹出窗口(子窗口)与一些选择。一旦用户在子窗口中提交它们,我将这些值传递给父窗口并提交表单。这些值被提交到后端,没有任何问题。但是,父窗口在提交表单时没有刷新。
function commonPopup(popup, width, height, e, top, left) {
myWindow=window.open('about:blank', popup, 'directories=0,scrollbars=yes, resizable=yes, location=0, menubar=0, status=0, toolbar=0, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
myWindow.document.write('<HEAD>');
myWindow.document.write(' <TITLE>Waiting for results</TITLE>');
myWindow.document.write('</HEAD>');
}
function post_lock_unlock_value(reason,comment) {
document.getElementById('lockReason').value = reason;
document.getElementById('lockComment').value = comment;
document.getElementById('triggerActionId').value='';
document.getElementById('admRepairLock').submit();
}
<s:form name="lock" id="lock" action="my.action">
<s:submit value="Lock Repair Profile" id="lockIndicator" name="lockIndicator"
onclick="commonPopup('lockProfile',450, 200, event,'lockRepairProfile');" cssStyle="width:200px" theme="simple"/>
</s:form>
子页
function postback() {
window.opener.post_lock_unlock_value("data","data");
self.close();
}
在关闭子窗口之前像这样刷新父窗口(将此添加到self.close()
之前):
if ( window.opener && !window.opener.closed ) {
window.opener.location.reload();
window.opener.focus();
}
try this:
var newPartyId = $("#desc_textarea").val();
window.opener.$("#desc_textarea").val(newPartyId);