码迷,mamicode.com
首页 > Web开发 > 详细

[转] 怎样用jquery关闭子页面,并刷新父页面

时间:2018-01-17 16:47:15      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:注意   load   ble   win   eve   模态   怎样   ref   col   

转自 https://zhidao.baidu.com/question/747776028293107892.html

 

如果是模态窗口弹出
<form name="form1">
<input type="text" name="fag1">
<input type="text" name="fag2">
</form>
function shw(){
var url="open.html";
//----------方法一--start-------
var obj=document.form1; //指定页面对象
var returnValue=window.showModalDialog(url ,obj,‘dialogHeight:550px;dialogWidth:500px;center:yes‘); //方法返回值
//----------方法一--end-------
alert(returnValue);
}
如果是非模态窗口弹出,那么
<script type="text/javascript">
//弹出窗口
function openwin(url,width,height){ 
var l=window.screen.width ; 
var w= window.screen.height; 
var al=(l-width)/2; 
var aw=(w-height)/2; 
var OpenWindow=window.open(url,"弹出窗口","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+width+",height="+height+",top="+aw+",left="+al+""); 
OpenWindow.focus();
if(OpenWindow!=null){ //弹出窗口关闭事件
//if(window.attachEvent) OpenWindow.attachEvent("onbeforeunload", quickOut); 
if(window.attachEvent) OpenWindow.attachEvent("onunload", quickOut); 
}
}
//关闭触发方法
function quickOut()
{
alert("窗口已关闭");
}
</script>
<input type="button" value="ok" onclick="openwin(‘open.html‘,‘600‘,‘500‘)">
<input type="text" name="txt0" id="txt0"> 注意:firefox这里一定要写ID属性,不然取不到值

 

[转] 怎样用jquery关闭子页面,并刷新父页面

标签:注意   load   ble   win   eve   模态   怎样   ref   col   

原文地址:https://www.cnblogs.com/bobo1713930654/p/8303539.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!