js浏览器-BOM的内置对像操作 页面的全屏 后退

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
                <a href="javascript:;">点击我可以穿件一个新的页面</a>
                <a href="javascript:;">点击我可以关闭本页面</a>
                <div>点击我跳转到百度</div>
                <script>
                    //新窗口 = window.open(地址,是否开新窗口,新窗口的参数);
                    var a1 = document.getElementsByTagName("a")[0];
            //        var a2 = document.getElementsByTagName("a")[1];
                    a1.onclick = function () {
            //            window.open("http://www.jd.com","_blank");
                        var json = {"name":"helloworld","fullscreen":"no","location":"no","width":"100px","height":"100px","top":"100px","left":"100px"};
            //            var newWin = window.open("demo.html","_self",json);
                        var newWin = window.open("demo.html","_blank",json);
                        newWin.moveTo(500,500);

            //            name:新窗口的名称,可以为空
            //            featurse:属性控制字符串,在此控制窗口的各种属性,属性之间以逗号隔开。
            //        fullscreen= { yes/no/1/0 } 是否全屏,默认no
            //        channelmode= { yes/no/1/0 } 是否显示频道栏,默认no
            //        toolbar= { yes/no/1/0 } 是否显示工具条,默认no
            //        location= { yes/no/1/0 } 是否显示地址栏,默认no
            //        directories = { yes/no/1/0 } 是否显示转向按钮,默认no
            //        status= { yes/no/1/0 } 是否显示窗口状态条,默认no
            //        menubar= { yes/no/1/0 } 是否显示菜单,默认no
            //        scrollbars= { yes/no/1/0 } 是否显示滚动条,默认yes
            //        resizable= { yes/no/1/0 } 是否窗口可调整大小,默认no
            //        width=number 窗口宽度(像素单位)
            //        height=number 窗口高度(像素单位)
            //        top=number 窗口离屏幕顶部距离(像素单位)
            //        left=number 窗口离屏幕左边距离(像素单位)
                    }
            //
            //        //关闭本页面
            //        a2.onclick = function () {
            //            window.close();
            //        }


                var div = document.getElementsByTagName("div")[0];
                    div.onclick = function () {
                        location.href = "http://www.baidu.com";
            //            window.open("http://www.baidu.com","_blank");
                    }
            //        console.log(location.href    )    //
            //        console.log(location.hash    )    //    返回url中#后面的内容,包含#
            //        console.log(location.host    )    // 主机名,包括端口
            //        console.log(location.hostname)    // 主机名
            //        console.log(location.pathname)    // url中的路径部分
            //        console.log(location.protocol)    // 协议 一般是http、https
            //        console.log(location.search	)     // 查询字符串


                    //navigator
            //        console.log(navigator.userAgent);
            //        console.log(navigator.platform);

                    //回退
                    //history.go(-1);
            //        history.back();


    </script>

</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值