3710人加入学习
(6人评价)
Web前端第三季(JavaScript)

制作完成于2018年6月14日

价格 免费
<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>window对象</title>
    <script type="text/javascript">
        //window浏览器窗口
        // var name = "siki";
        // console.log(window.name);
        // window.document.getElementById();

        // window.alert();
        // window.setInterval();
        // window.setTimeout();

        // var res = window.confirm("你确定要杀我吗?");
        // console.log(res);

        // var res = window.prompt("请输入你的性别:");
        // console.log(res);//输入结果,确定才会显示输入的内容,点击取消,显示null。

        // function myopen(){
        //     var w = window.open("http://www.sikiedu.com","new_window","width=500,height=500");
        //     w.resizeTo(400,400);
        //     w.moveTo(200,500);
        //     // w.close();
        //     w.focus();
        // }

        //window.screen
        // console.log(screen.availWidth);
        // console.log(screen.availHeight);

        // window.location
        console.log(location.protocal);
        console.log(location.hostname);
        console.log(location.port);
        console.log(location.pathname);
        console.log(location);

        // location.assign("603-广告弹框.html");
    </script>
</head>
<body>
    <button onclick="myopen()">打开</button>
</body>
</html>

screen( window.screen ) 获取屏幕分辨率
screen.availWidth - 可用的屏幕宽度
screen.availHeight - 可用的屏幕高度

location( window.location )
window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面。

location.hostname 返回 web 主机的域名
location.pathname 返回当前页面的路径和文件名
location.port 返回 web 主机的端口 (80 或 443)
location.protocol 返回所使用的 web 协议(http:// 或 https://)

window.location.assign("http://www.sikiedu.com")  相当于一个超链接的功能

[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(60)