zoukankan      html  css  js  c++  java
  • 确认关闭网页

    当用户关闭页面时,弹出对话框,让用户确认是否关闭,选择确定则页面关闭,否则页面不关闭。如下图所示,这个是非常常见。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>确认关闭网页</title>
    </head>
    
    <body  onbeforeunload = "return  '确定关闭网页?';">
        <input type="button"  onclick="javascript:window.opener = null; window.open('','_self'); window.close();" value="关闭网页"/>
    </body>
    </html>

    既然有关闭页面的弹出框,那肯定也有“关闭这个窗口,进入另一个页面”,其实是相同的道理

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>关闭本网页,进入新页面</title>
    </head>
    <body>
        <input type="button"  onclick="javascript:window.open('淘宝导航菜单.html','','fullscreen=yes,menubar=no,resizable=no');window.opener = null;window.close();"  value="打开新页面"/>
    </body>
    </html>
  • 相关阅读:
    bootstrapValidator重新校验/全选回显
    mybatis遍历map参数查询
    location.href传json字符串
    springmvc异步处理
    intellIJ IDEA学习笔记3
    intellIJ IDEA学习笔记2
    intellIJ IDEA学习笔记
    maven国内镜像
    Docker版本Jenkins的使用
    Docker容器网络
  • 原文地址:https://www.cnblogs.com/wanliyuan/p/3580578.html
Copyright © 2011-2022 走看看