js——BOM操作相关方法

版权声明:转发博客 请注明出处 否则必究 https://blog.csdn.net/lucky541788/article/details/82085114
    window.open();//打开新窗口
    open();//打开一个流,以收集来自任何document.write()或document.writeIn()方法的输出
    window.close();//关闭当前窗口
    close();//关闭用open()方法打开的输出流,并显示选定的数

    write();//向文档写入HTML或js代码
    writeIn();//等同于write()方法,不同的是在每个表达式之后写一个换行符

    window.moveTo();//移动当前窗口
    window.resizeTo();//调整当前窗口

    //可用屏幕宽/高
    screen.availWidth;
    screen.availHeight;

    screen.colorDepth;//色彩深度
    screen.pixelDepth;//分辨率


    //以我的浏览器为例
    //主机域名
    location.hostname;// localhost
    //当前页面路径和文件名
    location.pathname;// /github/QD-practise/ce%20shi/html/jq.html
    //web主机的端口
    location.port;//63345
    //所使用的web协议(http:或https:)
    location.protocol;// http:
    //返回当前页面整个url
    location.href;// http://localhost:63345/github/QD-practise/ce%20shi/html/jq.html?_ijt=ev26560levqk3jge58gml7gtr3


    location.assign();//加载新文档
    history.back();//返回上一页
    history.forward();//返回下一页


    //弹窗
    alert('someText');//警告框
    confirm('someText');//确定框
    prompt('someText',defaultValue);//提醒框 defaultValue为用户输入值(点击确定返defaultValue,取消返null)

猜你喜欢

转载自blog.csdn.net/lucky541788/article/details/82085114
今日推荐