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>
  • 相关阅读:
    c语言排序算法
    冒泡 选择排序
    冒泡排序算法
    Pandas数据预处理
    Mongodb的安装和配置
    Mysql练习题
    5 根据过去的行为能否预测当下
    Sklearn逻辑回归
    4 如何通过各种广告组合获取更多的用户
    Sklearn多元线性回归
  • 原文地址:https://www.cnblogs.com/wanliyuan/p/3580578.html
Copyright © 2011-2022 走看看