开、关窗口

<body>
    <a href="">点我打开一个新的页面</a>
    <a href="">点我关闭本页面</a>

    
</body>

    var a1 = document.getElementsByTagName('a')[0]
    var a2 = document.getElementsByTagName('a')[1]
    a1.onclick = function(){
        
        window.open("http://www.baidu.com","_blank",'width=100px,height=100px')
    }

    a2.onclick = function(){
        window.close();
    }

原文地址:https://www.cnblogs.com/yuanliy/p/14561341.html