`

模态窗口关闭时,刷新父窗口(js)

阅读更多

方式1:通过返回值判断,进行刷新操作。
父窗口页面js:

function findDetailsForAmount(outputBillDetailId,applyAmount,outputAmount){
	var url = "/innerallocateDetailAction.do?method=findDetailsForAmount&outputBillDetailId="+outputBillDetailId+"&applyAmount="+applyAmount+"&outputAmount="+outputAmount;
	var answer=window.showModalDialog(url,window,"dialogWidth=450px;dialogHeight=200px;scroll:no");
	if(answer==1){ // 返回值如果为1
		window.location.reload();      // 刷新父窗口
	}
}

 
打开的模态窗口js:

//窗口关闭时执行
window.onunload=function(){
	window.returnValue=1;   //父窗口中 answer的值
}

 

方式2:直接在打开的模态窗口操作
打开的模态窗口js:

//窗口关闭时执行
window.onunload=function(){
	var parentWin=window.dialogArguments;
	parentWin.location.reload(); //刷新父窗口
}

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics