弹出框刷新父页面

window.showModalDialog弹出刷新父页面:

父页面写:

function parentFun(){
	var returnValue = window.showModalDialog(url,window,'dialogWidth:500px;dialogHeight:450px;help:No;resizable:no;status:no;center:1;scroll:auto;');
	if(returnValue == "1"){
	 	window.location=turnURL;
	 }
}

 子页面写(ajax提交就是请求的回调函数)

function call_span(res){
	var result = res.responseText;
	window.returnValue=result;
	window.close();
}

 window.open弹出刷新父页面:

父页面写:

window.open(url,"div1","width=560px,scrollbars=no,location=no,status=no,height=420px,left=" + (window.screen.width-winWidth)/2 + ",top=" + (window.screen.height-winHeight)/2);

 子页面写(ajax提交就是请求的回调函数):

function kink_callback() {
	if (req.readyState == 4) {
		if (req.status == 200) {
	  		var obj=parent.window;//弹出窗口对象
	  		obj.opener.location=url;
			window.parent.close();
		} else {
			alert("数据操作有误,请检查数据!");
		}
	}
}
 

你可能感兴趣的:(js,window.open,web 前端)