javascript怎么关闭当前窗口

第一种:不带任何提示关闭窗口的js代码

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

第二种:自定义提示关闭#

<script language="javascript">
// 这个脚本是 ie6和ie7 通用的脚本
function custom_close(){
if 
(confirm("您确定要关闭本页吗?")){
window.opener=null;
window.open('','_self');
window.close();
}
else{}
}
</script>
 
<input id="btnClose" type="button" value="关闭本页" onClick="custom_close()" />
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容