window对象方法(open和close)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>window对象方法(open和close)</title>
    <!-- 
        window.open("url","name","parameters");url:链接;name:链接标题;parameters:可以有多种属性
                    当url为""时,也会打开一个空白窗口
        window.close();关闭当前窗口

        扩展知识:
        width宽度,height高度,left左距离,top上距离,toolbar工具栏,menubar菜单栏,scrollbars滚动条,location地址,status状态栏
     -->
</head>
<body>
    <input id="op" type="button" value="打开">
    <input id="cl" type="button" value="退出">
    <script>
        var op=document.getElementById("op");
        var cl=document.getElementById("cl");
        op.onclick=function (){
            window.open("https://www.baidu.com/","百度一下,你就知道","width=300,height=250,left=0,top=0,toolbar=no,menubar=no,scrollbars=no,location=no,status=no")
        }
        cl.onclick=function (){
            window.chose();//关闭窗口
        }
    </script>
</body>
</html>

posted on 2019-12-21 17:08  loongw  阅读(792)  评论(0编辑  收藏  举报

导航