JS刷新窗口,关闭窗口

一、刷新窗口

  

document.location.href=document.location.href;

二、关闭窗口

1、 不带任何提示关闭窗口

<a href="javascript:window.opener=null;window.open('','_self');window.close();">关闭</a>

2、自定义提示关闭

<script language="javascript">
// 这个脚本是 ie6和ie7 通用的脚本
function custom_close(){
if 
(confirm("您确定要关闭本页吗?")){
window.opener=;
window.open('','_self');
window.close();
}
else{}
}
</script>  
 <input id="btnClose" type="button" value="关闭本页" onClick="custom_close()" />

 

posted @ 2018-08-31 10:05  RivenLw  阅读(258)  评论(0编辑  收藏  举报