zoukankan      html  css  js  c++  java
  • JS 浏览器BOM-->close() 方法

    1.定义和用法

      close() 方法用于关闭浏览器窗口。

      语法:

        window.close()

     举例

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>菜鸟教程(runoob.com)</title>
    <script>
    function openWin(){
        myWindow=window.open("","","width=200,height=100");
        myWindow.document.write("<p>这是'我的窗口'</p>");
    }
    function closeWin(){
        myWindow.close();
    }
    </script>
    </head>
    <body>
    
    <input type="button" value="打开我的窗口" onclick="openWin()" />
    <input type="button" value="关闭我的窗口" onclick="closeWin()" />
    
    </body>
    </html>

      输出:

  • 相关阅读:
    android 学习
    android 学习
    android 学习
    android 学习
    android 学习
    android 学习
    android 学习
    android 学习
    android 学习
    每日日报
  • 原文地址:https://www.cnblogs.com/abner-pan/p/12709291.html
Copyright © 2011-2022 走看看