问答详情
源自:2-6 JavaScript-关闭窗口(window.close)

求完整的答案代码​

求完整的答案代码

提问者:qq_心随风动_0 2015-08-24 23:12

个回答

  • 老冯as
    2015-11-12 12:22:44

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>close()</title>
      <script type="text/javascript">
       var mywin;
      function Open(){
        mywin=window.open("http://www.imooc.com");
      }
      function Close(){
        mywin.close();  
      }
      </script>
    </head>
    <body>
    <input type="button" value="打开" onclick="Open()" >
    <input type="button" value="关闭" onclick="Close()" >
    </body>
    </html>


  • Perona
    2015-08-25 08:33:38

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>close()</title>
      <script type="text/javascript">
         var mywin=window.open("http://www.imooc.com");
         mywin.close();
      </script>
    </head>
    <body>
    </body>
    </html>