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>
  • 相关阅读:
    Ubuntu 下配置ftp服务端
    mysql的sql文件的备份与还原
    Virtualbox后台管理之VBoxManage
    主从库延迟对项目质量的影响
    jenkins / ant / jmeter 持续集成接口自动化
    infer 检验IOS项目
    pmd静态代码分析
    利用线上数据验证系统 Gor
    python flask (一)
    python SQLAlchemy
  • 原文地址:https://www.cnblogs.com/wanliyuan/p/3580578.html
Copyright © 2011-2022 走看看